js |
JavaScriptタグが付けられた新着投稿 - Qiita |
JS import,exportに関して |
https://qiita.com/sora8han/items/4ba2187e4597282252f7
|
default |
2022-03-21 09:30:26 |
海外TECH |
DEV Community |
Linked List in JavaScript |
https://dev.to/fig781/linked-list-in-javascript-4a19
|
Linked List in JavaScriptWhat is a Linked List A linked list data structure involves a series of Nodes linked together Each Node will have a data value and a reference to the next Node in the list In the last Node the reference will be set to null Linked lists are not commonly used in front end web development but they are still very popular for interview coding problems Here is a simple implementation of a Linked Listclass Node constructor data next null this data data this next next class LinkedList constructor this head null Inserts a Node into the Linked List insertFirst data this head new Node data this head Returns the number of nodes size let node this head let count while node count node node next return count Returns the first Node getFirst return this head Returns the last Node getLast if this head next return null let node this head while node if node next return node node node next Removes all Nodes from the Linked List clear this head null Removes the first Node from the Linked List removeFirst if this head this head this head next Here it is in use let list new LinkedList list insertFirst list insertFirst list insertFirst list head data next data next data next null list getFirst data next list getLast data next null list size list removeFirst head data next list clear head null You will notice that a Linked List in JavaScript is simply a series of nested objects The list will always start with a head and the last node reference will be null If you are preparing for coding interviews here are a few coding challenges involving Linked ListsLinked List CycleMiddle of the Linked ListPalindrome Linked ListRemove Linked List ElementsReverse Linked ListLeave a comment if you have any questions or feedback |
2022-03-21 00:16:00 |
海外TECH |
DEV Community |
Learning Rails #2 - Migrations |
https://dev.to/jessesousa/learning-rails-2-migrations-2952
|
Learning Rails MigrationsThe role of these series is to be used as a refresher and a place where beginners can discuss If you re also learning or intend to learn Rails I highly recommend that you follow the Getting Started section of the Rails Guides When creating a model a migration file is also generated You should see a file like create users rb in thedb migrate folder this giant number is a timestamp This is the migration file of your model and if you click it you see that inside that are all attributes that you made and its types After creating a model you have to run the migration in order to update the database creating a new table for the model What is a Migration A Migration basically is a script that will have all the code needed to change your database Basically every change you make to the database should be through a migration For example Let s say you created a model for users and ran its migrations then you realize you forgot the email attribute you can solve this problem by creating a new migration file rails generate migration AddEmailToUsersAnd in the migration file you can add any changes in our case we need to add an email attribute so we ll do In the migration fileclass AddEmailToUsers lt ActiveRecord Migration def change add column users email string endendNow rails db migrateNow all migrations will run hence the database will be updated How to use Migrate and Rollbackrails db migrateAs we ve seen before this will run all the migrations rails db rollbackIt will run the inverse command for everything a migration did sometimes you ll need to write it yourself check the documentation for more information By default the commands above will run all the migrations you have using the timestamp to track the order of when which script should run To run only the migrations you want use the STEP parameter Ex rails db migrate STEP this will run only two migrations files |
2022-03-21 00:14:45 |
海外TECH |
DEV Community |
Tales of the Autistic Developer – The Politician |
https://dev.to/baweaver/tales-of-the-autistic-developer-the-politician-5aid
|
Tales of the Autistic Developer The PoliticianFor those who don t know me I m autistic I ve been a developer for the better part of a decade I didn t find out I was ASD until and didn t reconcile with that until years later These posts will be a combination of advice I ve given to those who are like me as well as a letter of sorts to my past self who could have used a lot of it I write these posts in the hopes that someone like me will find value in knowing a very simple and very important truth about ASD You are not alone and you are loved The PoliticianIf you were to ask any number of engineers what their most dreaded part of the job is it would not be surprising to see many answer politics Bureaucracy roadblocks arguments everywhere and all seemingly for no good reason other than to make things slow Yet politics are perhaps the most important part of a software engineers job Now autistic folks we re not known for our social graces and understanding of fine nuance If politics are such an integral part of the job it seems counterintuitive if not impossible that someone that s autistic has found any reasonable success there That dear friends is precisely what this post is going to address Defining the TermTo start when I say politics what exactly do I mean How do we define that for the sake of this article We will be taking a very narrow focus on corporate politics at scale and how they relate to team dynamics in a company at varying levels We will not be addressing global politics and how that relates to corporate as that s deserving of a much longer post with far more nuance and attention than I m capable of giving it at the moment Sufficient to say this type is exceptionally important and companies that pretend otherwise do so to their folly The New Politician Local ScopeWhen you re new to a job your focus is exceptionally localized and the politics you tend to be exposed to are likewise exceptionally localized When I was at this level I saw a problem and I solved it simple as that Whenever someone stopped me from doing so or changed my trajectory I would scowl off and complain about politics rather than take time to understand what was really going on The ProblemThis led to a lot of problems as I would very frequently feel betrayed or otherwise ignored whenever my work would dramatically shift assuming that those above me didn t get it When I felt this I would start raising arguments and advocate very harshly for what I believed should be done I would broker no discussion and fail to listen because in my mind I knew what needed to be done and others just didn t get it yet Because of how fixated I became on localized problems I missed the much wider picture of the business value the team was meant to deliver and the strategic direction of my leadership Likewise I did not want to be involved in all of these meetings about planning backlog grooming quarterly roadmapping or other strategic meetings I d found them to be a massive waste of time when we could just work on what was in front of us and the very obvious problems as I saw them The SolutionA recurring theme throughout my posts and one thing that I want to repeat as many times as necessary Listen then listen more then make absolutely sure you ve heard and listened again before opining I had to start to learn what the wider picture was of the team and where they were headed and how my work fit into that picture Once I started to see that picture it made a lot more sense why work I had thought was important did not get prioritized and why it seemed that I was constantly thrashing in my job instead of getting things done The StrengthPerhaps ironically my stubbornness and insistence on seeing something through led to a very unusual strength that s been commented on even up to today tenacity If I truly believe something is an issue I fully intend to pursue it and make sure it s fixed When I learned to start listening I learned which issues were actually issues and which ones were me not understanding the situation It also taught me how to frame issues so that they would be prioritized by aligning myself with management and leads to show why it should be valued over other tasks It was also the start of me seeing business value in what I did and how that translated into my teams deliverables The Experienced Politician Team ScopeOnce you ve had a few years to mature as an engineer and before you get to senior you fall into one of the most dangerous parts of your career It s a valley where one can presume expertise and knowledge where it isn t and because of that you foster exceptionally strong opinions Any of the strengths from the last section can become exceptional weaknesses if leveraged wrongly The ProblemThe buried lede in the previous strength section is whether I truly believed something to be an issue Given how self righteous I was in the past you can imagine this was a very very bad idea as it would lead me to advocating exceptionally strongly for things that weren t really issues Even worse now I had enough sense to frame the case in such a way that I could potentially get the work roadmapped whether or not it made sense I say this is a dangerous period as you have just enough experience to make a case but not enough maturity to do so wisely yet We mistake knowledge for wisdom and with it the discretion that should be there to prevent self righteous crusades and tilting at windmills The SolutionRemember the solution to the last section Listening It s a lesson that bears repeating daily if not hourly or minutely perhaps even more frequently The higher level you become the more fatal it is not to listen and go along with creating your own solutions without input from others This was the stage of my career where I begun to form networks of friends coworkers organizational teammates and company experts Through them I could check myself to make sure what I was doing made sense vet ideas and qualify if this was something that was truly an issue or if I was just particularly worked up that day It forced a reliance on my team rather than acting out as an individual apart from them even though leveling scope would have you believe self sufficiency is the ultimate goal The StrengthPerhaps my greatest strength as an engineer is my network I m one person there s no possible way I have all the context required to make decisions and the higher leveled I became the more critical this skill became In later sections I ll highlight how this grew but for now this was the start of me building and working through my network albeit at a minimal scope at this moment The Senior Politician Team to Organization ScopeAfter you get beyond the brick wall before senior levels you ll find still more hurdles to overcome This is the level where representation matters delegation enters the conversation and cross team planning becomes a requirement to get progressively larger tasks done The ProblemBy now I had cooled my head learned to listen to others but I had a whole new level of problem to contend with I had to convince other people that something was a good idea to pursue More often than not I would do so by informal conversations convincing people to help with work outside of the scope of their teams roadmaps if not completely aside from it I would try and circumvent the chain of command at a company for expediency on projects I happened to think were important Needless to say this did not endear me to people outside of my team and organization as I represented a risk factor that could derail their roadmap by not considering the implications of the work I was trying to get people to do The SolutionProcess surprisingly exists for a very good reason That meant getting things roadmapped for other teams and learning negotiation skills when consulting with other team leads and managers rather than taking advantage of engineers who didn t happen to know any better Granted there s another message in there about volunteer culture and how that can dramatically backfire but we ll get into that in a moment No for this section the growth areas were around learning to negotiate and get things on a roadmap schedule the work and then see it through rather than tossing something over the fence and hoping it magically showed up done on the other side It meant having uncomfortable discussions and accepting when the answer was sometimes no and working with that to reprioritize or in rare cases escalating to surface truly severe concerns Sometimes even then the answer is still no and I had to learn how to work with that The StrengthThrough this I had learned how to start negotiations how to prepare formal documents and proposals and how to make effective cases for what I believed should be done which led to a much higher rate of success and delivery In some ways one could fairly say give us a proposal is code for screw off we re busy and they may be right there though I choose to take a sunnier view of that and say it s more likely to mean they need a full story of the scope of the request and the details behind it beyond a simple X is a problem we should fix that It taught me to solidify context and details of problems into actionable items that could be delivered to others rather than requiring my direct involvement to get things done It was the start of me learning to delegate and break apart work which is what got me to Staff levels The Staff Politician Organization to Company ScopeBeyond Senior levels there s a much higher wall to climb to Staff levels and that s because the lesson here is that it s no longer an individual contributor s job it s a leader s job to work through an entire organization rather than trying to play solo hero any more It s a hard lesson to learn and I was no exception The ProblemYou spend years building engineering intuition on how to solve a problem yourself You could totally get it done in a few hours if they d let you they just don t understand how simple it actually is they re overcomplicating things Sufficient to say I was still fairly arrogant at this stage of my career I believed I could solo tasks that were well beyond the realm of what any single engineer should ever attempt on their own Not because I couldn t no but because I shouldn t The SolutionShouldn t is a real loaded word there What do I mean by that If a problem is beyond the scope of a single engineer and can effect a whole organization and even the entire company there s no possible way that engineer has enough context to fully realize and deliver on that problem To think otherwise is folly and likely to lead to a lot of misses in delivery for not really understanding a domain and customer requirements The solution again was listening and on a much grander scale It meant having several meetings message chains documents proposals and more to make sure a domain was fully explored and qualified rather than making assumptions that could lead to failure It meant no longer being an engineer but being a representative for an entire organization of engineers that trust you to make wise decisions Sometimes this can even reach a company scale at this level It means that all the negotiation skills developed up to this point are now table stakes for any reasonably sized job The StrengthThrough this I had also learned a critical skill that I had not quite realized Delegating at that scale means that you can grow engineers effectively It means that you can ensure people are connected that can help each other grow that you can give tasks that address weaknesses and that you can create examples of competencies that can be leveraged in promotions At this stage I started to realize the ability to level up an entire organization around me and start to establish networks of experts not only in the company but in the entire industry It was the beginning of me starting to actually lead and hopefully do so wisely as a representative of both my team and organization The Principal Politician Company to Industry ScopeAfter all of this I find myself at a new stage that of a Principal Engineer that is still beyond my full understanding Really Staff in many cases may still be At this level any decision you make can rock an entire company if not the entire industry around you and because of that it requires exceptional wisdom patience and listening to succeed in Unfortunately I only have two of those on a good day and which two those are depends on the problem at hand The ProblemBy now you re not only a representative for your organization but for the entire company if not the entire industry To say that that requires a deft and steady hand is an exceptional understatement The cost of failure becomes exceptionally high even terrifying to the point of stagnation and avoidance of unfamiliar territory It can mean becoming stuck in your ways and refusing to change returning and harkening to some of the arrogance from previous stages The problem now is that you have enough experience to back that up and using it irresponsibly can do immeasurable damage to a company and its engineers Being the representative of an entire company is a significant responsibility The SolutionFail Fail often fail fast and be willing to make mistakes Of course this sounds patently absurd who would recommend failing as a solution The trick here is to fail in such a way that you ve made it cheap easy and fast to recover and shift positions It allows you to take much larger risks safely and qualify risks that may otherwise be unknown through formal proposal and discussion Even the best decisions and most well thought out proposals will inevitably have failure modes It s impossible to get everything right so optimizing for such can be foolish and costly as it presumes a perfection which will never exist Amusingly even if you could get something perfect it would still be wrong because software is by nature a moving target Demands change needs shift customers cycle and no one person can reliably predict the future Through maturity though they can certainly make some educated guesses The StrengthBy being willing to fail and consider the risks taken one starts to develop skills of tactical investments and being able to delegate entire organizations to pursue promising potentials and qualify whether or not they pan out It develops a far more robust model of software where teams are safe to make mistakes to grow and learn at a much larger scale and start to produce more Staff level competencies and perhaps beyond When failure is untethered from shame it allows for growth and transparency at a company scale and a much healthier engineering culture will emerge from it In conjunction with the other strengths an engineer executing at this level can do some incredible things Truthfully these are still lessons I am learning and will continue to learn over the next few years as I mature into this level myself Closing ThoughtsPolitics take different shapes at every stage but the truth of the matter is that there needs to be a healthy relationship with expectations at every level for there to be safety to grow in them Some companies naturally will be exceptionally hostile here with top down mandates while others will have no structure and let people do as they will Both have their failure modes and create very different political climates to work in In many ways I am still ever much the fool in regards to political nuance at work but I have certainly grown from where I was in the past and can see ways I can continue to improve myself in the future One step at a time we grow every day and you re just as capable of that growth yourself So go out experiment fail and above all LISTEN |
2022-03-21 00:08:20 |
ニュース |
BBC News - Home |
Ukraine war: The lonely funeral of a young soldier in Ukraine |
https://www.bbc.co.uk/news/world-europe-60801586?at_medium=RSS&at_campaign=KARANGA
|
russian |
2022-03-21 00:32:12 |
ニュース |
BBC News - Home |
E-waste: Royal Mint wants to turn your old phone into gold |
https://www.bbc.co.uk/news/uk-60796417?at_medium=RSS&at_campaign=KARANGA
|
boards |
2022-03-21 00:01:51 |
ニュース |
BBC News - Home |
Kenya’s Killer Roads: Dodgy driving licences and dangerous vehicles in Kenya |
https://www.bbc.co.uk/news/world-africa-60800307?at_medium=RSS&at_campaign=KARANGA
|
safety |
2022-03-21 00:01:54 |
ニュース |
BBC News - Home |
Not smart but clever? The return of 'dumbphones' |
https://www.bbc.co.uk/news/business-60763168?at_medium=RSS&at_campaign=KARANGA
|
connection |
2022-03-21 00:04:45 |
ニュース |
BBC News - Home |
Oscars 2022: Five ways the Academy is trying to stay relevant |
https://www.bbc.co.uk/news/entertainment-arts-60616273?at_medium=RSS&at_campaign=KARANGA
|
awards |
2022-03-21 00:05:54 |
ニュース |
BBC News - Home |
Loan sharks trap poorest as cost of living crisis bites |
https://www.bbc.co.uk/news/uk-60766810?at_medium=RSS&at_campaign=KARANGA
|
england |
2022-03-21 00:40:43 |
ニュース |
BBC News - Home |
The hunt for Nigerians who can change into cats |
https://www.bbc.co.uk/news/world-africa-60749496?at_medium=RSS&at_campaign=KARANGA
|
nigerians |
2022-03-21 00:14:31 |
ニュース |
BBC News - Home |
Liverpool & Man City: Two teams, three trophies left – who will win what? Danny Murphy analysis |
https://www.bbc.co.uk/sport/football/60817143?at_medium=RSS&at_campaign=KARANGA
|
Liverpool amp Man City Two teams three trophies left who will win what Danny Murphy analysisMOTD pundit Danny Murphy says whatever happens next it has already been a very good season for Liverpool and Manchester City but it could turn out to be a very special one |
2022-03-21 00:04:29 |
北海道 |
北海道新聞 |
「第3次大戦」回避へ首脳会談を ゼレンスキー氏が呼び掛け |
https://www.hokkaido-np.co.jp/article/659302/
|
首脳会談 |
2022-03-21 09:26:01 |
北海道 |
北海道新聞 |
林氏、原油供給確保を要請 UAE外相と連携確認 |
https://www.hokkaido-np.co.jp/article/659312/
|
日本時間 |
2022-03-21 09:08:35 |
北海道 |
北海道新聞 |
PSV堂安、リーグ6点目 オランダ1部、チームは大勝 |
https://www.hokkaido-np.co.jp/article/659314/
|
大勝 |
2022-03-21 09:19:00 |
北海道 |
北海道新聞 |
地方気象台の定員削減 札幌に業務集約し地域防災支援に注力 |
https://www.hokkaido-np.co.jp/article/659284/
|
地方気象台 |
2022-03-21 09:04:14 |
コメント
コメントを投稿