<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Megan Lo on Medium]]></title>
        <description><![CDATA[Stories by Megan Lo on Medium]]></description>
        <link>https://medium.com/@meganslo?source=rss-963906d24739------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*d9fFrolmFsHv8ni3__07qg.jpeg</url>
            <title>Stories by Megan Lo on Medium</title>
            <link>https://medium.com/@meganslo?source=rss-963906d24739------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 12:05:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@meganslo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[My Journey On Grinding Leetcode As A Bootcamp Grad]]></title>
            <link>https://meganslo.medium.com/my-journey-on-grinding-leetcode-as-a-bootcamp-grad-a60137afbdc9?source=rss-963906d24739------2</link>
            <guid isPermaLink="false">https://medium.com/p/a60137afbdc9</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[Megan Lo]]></dc:creator>
            <pubDate>Thu, 02 Mar 2023 18:41:47 GMT</pubDate>
            <atom:updated>2025-05-22T22:16:41.985Z</atom:updated>
            <content:encoded><![CDATA[<h4>This article is for you if you’re feeling discouraged to grind Leetcode</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*6JyPLS63Q_0PJ59zxl6rwQ.png" /><figcaption>Background Design: Canva</figcaption></figure><p>Hello there! You found this article and read the title. You may feel unmotivated grinding Leetcode, that’s why you clicked into this article. So here it is. To my new readers, I want to start with my background to give you a better sense on why I am writing this article today.</p><h4>Table of Content</h4><ul><li><a href="#fe21">My Background</a></li><li><a href="#731c">Why I Started Grinding Leetcode</a></li><li><a href="#d729">How Do I Even Start?</a></li><li><a href="#2b2f">High-Level Steps On Learning and Practicing DSA</a></li><li><a href="#9480">Resources I Use And Why I Chose These Resources</a></li><li><a href="#e2cd">Resources I’ve Used In the Past but Didn’t Work For Me</a> [As A Beginner]</li><li><a href="#16cf">How I Keep Myself Productive</a></li><li><a href="#9807">Wrap Up</a></li></ul><h4><strong>My Background</strong></h4><ul><li>Undergrad in non-STEM major (shout out to sociology 🎉)</li><li>Bootcamp grad in 2020 (Flatiron, anyone??)</li><li>Already worked in the industry for almost a year (but that doesn’t eliminate the fact that I still sucked at Leetcode when I got my first job)</li><li>Most importantly, I am not grinding Leetcode for the sake of joining a FAANG company.</li><li>It took me 2 years to finally learn ways to effectively practice Leetcode without feeling discouraged.</li></ul><h4>Why I Started Grinding Leetcode</h4><h4>I. Mass Layoffs Happened</h4><p>Let’s step back a little bit before I start the “why” part. I was part of the first wave of mass layoff back in July 2022 and had been job searching ever since. Before the FAANG layoffs starting from November, I heard back from at least 2–3 companies each month out of every 25 applications I sent [Recruiters reached out to me when I first got laid off, but then those didn’t work out, so I started applying online in Month 2.]</p><p>By Month 4, I had experienced different types of interviews, including take home assignments, API questions [Small plug of this article I wrote back in Nov: <a href="https://medium.com/@meganslo/interview-edition-design-a-rest-api-as-a-junior-engineer-450b7586c64f">Interview Edition: Design a REST API as a Junior Engineer</a>], live coding in React/Vanilla JavaScript, a small touch of system design, and last but not least, data structure and algorithms.</p><p>The mass layoff kinda happened unexpectedly, so I wasn’t prepared for any kinds of interviews. My previous role had nothing to do with full stack, but here I am, applying for full stack roles. My interview skills were off the chart. I bombed almost all technical interviews. I couldn’t do Leetcode Medium questions by myself, or if I did, it’d take me more than an hour. If I hear anyone talking about trees and graphs, I was legitimately scared, but deep down I know, as much as I fear grinding Leetcode, I understand it’s one of the few ways to get an entry level job. [Another way is that if you’re super proficient in one or few of the mainstream libraries, say ReactJS.]</p><h4>II. Having CRUD Projects Is No Longer Enough</h4><p>I mean it is always not enough. As more and more bootcamp grads graduated from their bootcamps over time, the job market is filled with job seekers who share the same set of skills along with self-taught devs and recent CS grads. How are people going to make themselves stand out based on a piece of paper [or PDF lol]?</p><p>In order to make yourself stand out, first and foremost, you’ll need to rely on networking [Duh]. Or if you’re like super motivated, feel free to take an extra step to advance your skills [For instance, if you know how to do Custom/Ref React Hook as a recent bootcamp grad, seriously kudos to you] and then build a super cool project with this new knowledge you obtain [not Weather App, or Blog App]. But as someone who is eager to look for a SWE job ASAP [honestly, a lot of these stuff can be learned at your new job], it is a lot of pressure to learn something completely new and then expect yourself to be able to explain what the heck is happening at a job interview.</p><p>If DSA is not part of the technical interviews, then you have to be sure to be able to explain some of the core Web Dev concepts. Like:</p><ul><li>How does the server communicate with the client? [Hint: request/response cycle]</li><li>How do you add multiple users into a database?</li><li>When you have multiple users in the database, how do you make sure the client side is requesting the right user? And how do you prevent the client being able to see other users’ information?</li></ul><p>[Just brainstorming some questions I’ve gotten in interviews and the concepts I need to understand before going into these interviews]</p><p><strong>However, I am sorry not sorry that I am not someone who can consume so much dry theory at once. Therefore, the other alternative I can think of is grinding Leetcode.</strong></p><h4>Question *Dwight’s voice*: How Do I Even Start??</h4><p>For someone who knew absolutely almost nothing about trees and graphs, anything other than arrays and dictionaries/objects/hashmaps, it was an extremely daunting experience going into this rabbit hole. I’d be lying if I said I did not feel discouraged and unmotivated right away. It takes at least one semester for a CS student to learn the fundamentals of DSA, on top of that, they have to diligently practice Leetcode to be interview-ready. We’re talking about at least 6 months — 1 year. I remembered feeling super discouraged when I was doing a timeline calculation.</p><p>So for my bootcamp grads/self taught devs out there, you may have come across a lot of articles on “Tips on prepping for FAANG in 3 months”. <strong>Those articles are targeted to people who have prior knowledge and/or background in computer science. </strong>Knowing how to traverse a binary tree, inserting into/removing a node from a binary search tree is like DSA 101 in college curriculum. So if you don’t know, that’s alright.</p><p>I started grinding Leetcode back in late November — December (it was such good timing due to the holidays), and more intense grinding starting from early Jan this year, so it’s been 4 months since the beginning of the journey.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/1*94HkbelTZW6KB3K2dFpwcg.png" /><figcaption>My Leetcode Submission Chart</figcaption></figure><h4>High-Level Steps On Learning and Practicing DSA</h4><p>Here are the high-level steps:</p><ol><li>Learn fundamentals (Array, Strings, Stack, Queues, Hashmap, Linked List, Binary Tree/Binary Search Tree, Graphs) and Understand Big-O Complexity.</li><li>After understanding one specific topic [Structy — see below why I love Structy], feel free to get started with easy level questions, so you get a sense of how to apply those concepts into a question. If stuck, use both the discussion and solution board to at least help you get started. Revisit the questions a few days later if needed.</li><li>Once you understand fundamentals and **somewhat** able to do easy questions, start attempting medium questions and start recognizing patterns between questions [Make use of the Similar Question tab on Leetcode] and understand which data structures you can apply to each question.</li><li>Following point 3, start using other resources to recognize patterns, which by the way Structy (see below) is already helping you if you haven’t noticed.</li><li>When you get to this point, give mock interviews a try. It helps practice your communication skills among other things.</li><li>And repeat the steps.</li></ol><p>Please be patient that the whole process will take around at least 3–6 months. In order to get really really good at it, it’ll probably take more than 6 months — 1 year. But the point is not about getting really good at Leetcoding, it’s about how you approach and solve a problem and whether you understand the core concepts of data structures and algorithms.</p><p>In the next section, I will share the resources I’ve used in chronological order to help me get started with my journey.</p><h4>Resources I Use And Why I Chose These Resources</h4><p>✨ Again, in chronological order✨</p><ul><li><strong>This blind post 📝: </strong><a href="https://www.teamblind.com/post/Giving-back---How-to-succeed-in-FAANG-coding-interviews-for-non-CS-holders-7CKEmXUn"><strong>Giving back — How to succeed in FAANG coding interviews? (for non-CS holders)</strong></a><strong> </strong>[As of Mar 2, 2023, this post is no longer available, but I want to keep the link here regardless.]</li></ul><p>Back in November-ish 2022, I was in desperate need of help. I found this post via Google search and it gave me the first motivation and realization that I can grind Leetcode without frustration <strong>[given the job market is not great + FAANGs mass layoffs + I wasn’t getting interviews anyway at that time. I knew I had all the time that I needed to prepare for this]</strong>. Although it is somewhat catered to SWEs applying for FAANGs, since FAANGs have higher and harder standard, I think this is a good guideline on how to find the right resources and how to plan out an effective plan to grind Leetcode. I recommend skimming through before moving on from here.</p><ul><li><strong>Book 1 📚: </strong><a href="https://a.co/d/fHAoE6B"><strong>Grokking Algorithms: An Illustrated Guide for Programmers and Other Curious People Aditya Bhargava</strong></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DgbHVJRwEgq8ZTn8.png" /><figcaption>Book Cover of Grokking Algorithms</figcaption></figure><p>I feel like this book is in every SWE’s bookshelf or computer (if you are reading electronically). It’s one of the most fun books I’ve ever read. It doesn’t get too in-depth into one concept but enough for you to understand what’s going on. I usually use this to review or after when I finish learning a data structure, I will read this book to help visualize the concepts. This book introduced me to algorithms like DFS and BFS.</p><ul><li><strong>Book 2: </strong><a href="https://a.co/d/2jpHyBh"><strong>A Common-Sense Guide to Data Structures and Algorithms, Second Edition: Level Up Your Core Programming Skills</strong></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*05TF7PdYpluKAAG9.jpg" /><figcaption>Book Cover of <a href="https://a.co/d/2jpHyBh">A Common-Sense Guide to Data Structures and Algorithms</a></figcaption></figure><p>This book is lowkey underrated. I haven’t heard many people talking about this book while everyone else recommends CTCI [Cracking the Coding Interview]. I find this book super friendly to non-CS background folks. After reading Grokking Algo book, I started reading this book to get a more in-depth conceptual understanding. They also introduced some new concepts to me and I would move on using other resources to help me put the concepts in practice. I also use this book to review concepts when I need to. The code implementation examples are a mix of Ruby, Python and JavaScript. I see this as a benefit of learning how to read other languages as well.</p><ul><li><a href="https://structy.net/"><strong>structy.net</strong></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ekGaa3NakST8PKfOfxu3Kg.png" /><figcaption>Screenshot from <a href="https://structy.net/"><strong>structy.net</strong></a></figcaption></figure><p>I. Absolutely. Love. <a href="https://structy.net/">Structy</a>. I have recommended this site to many friends who are looking to learn graphs and trees + boost their DSA skills. 100% positive reviews from my friends. <strong>If you want to have a good introduction to more difficult concepts (specifically graphs, trees and DP) and learning how to recognize patterns in general, this is the place.</strong> Alvin, the instructor who used to teach at App Academy (for those who don’t know, it is one of the top bootcamps), is really good at breaking down concepts and explain what patterns to use. (I don’t want to confuse readers who don’t know what patterns are. We are talking about Two Pointers, Sliding Windows, etc.) Like you would wish he is your Math professor because he would make Math so easy for you to understand and he is that kind of teacher. Structy provides Approach, Walkthrough, Code Implementation videos in each question. All of these videos are around 10–15 min each. Very easy to watch and follow. In case no one has told you, you could watch in 1.25x/1.5x speed. The Prompt + IDE layout is super fun and unique to look at, which separates itself from other DSA practice sites.</p><p>One of my favorite parts about Structy is that the questions are intentionally designed to be in the specific order on the list. This is something Alvin has mentioned in the intro video: <strong>try not to skip questions because the pattern you learn from this one specific question will help you work on the next one with some modifications and variations.</strong></p><ul><li><a href="https://neetcode.io/practice"><strong>Neetcode 150</strong></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qxFjcN84V0uz030Proi1Cg.png" /><figcaption>Screenshot from <a href="https://neetcode.io/practice"><strong>Neetcode 150</strong></a></figcaption></figure><p>If you know <a href="https://www.techinterviewhandbook.org/grind75">Blind 75</a>, you probably already know this. Neetcode said it himself that he created Neetcode 150 to be more beginner-friendly and help whoever using this list to practice to recognize patterns. If you ever grind Leetcode and need tutorials, Neetcode is pretty much like everyone’s go-to Youtube channel/person. Even my friends who are super advanced in their Leetcode skills will use Neetcode as a point of reference to improve their code and write cleaner code. I would also credit Neetcode for teaching me to write cleaner and better code. When I am looking for Leetcode questions to practice, this is the list I would look into.</p><ul><li><strong>Free Online College Course: </strong><a href="https://courses.edx.org/dashboard/programs/305e17b9-bcef-4188-9676-20c8c25af07d/"><strong>GTx’s [Georgia Tech on Edx] CS1332x Data Structure &amp; Algorithm</strong></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HacWbb_-X1SIf1ZmD2oHWQ.png" /><figcaption>Screenshot from Edx Dashboard</figcaption></figure><p>This course is equivalent to one college semester of fundamental of data structures and algorithms course. There are many, many top colleges which provides free DSA online courses. But this one is personally my favorite because the course is not super Math-y. <strong>It is stated in the course that they expect their pupils to spend 200 hours in this course, in other words, at least 10 hours per week.</strong> I do recommend dedicate as much as time as you can in this course, use their interactive tools and work on the assignments to understand the concepts better. If you decided to enroll the course for the professional certificate [which is not free], <strong>Java knowledge is required</strong>, so I would also recommend to learn some Java syntax before joining this course.</p><p>[Here’s a Java course also provided by Georgia Tech that I recommend: <a href="https://courses.edx.org/dashboard/programs/a6a971e7-84f4-4f10-bb15-eb577222ed44/">Introduction to Object-Oriented Programming with Java</a>. As a SWE, I think it’s important to not only understand DSA, but also OOP. If JavaScript is your most fluent language, it might not be as hard as you think to pick up Java because they share A LOT OF similarities in syntax. Most importantly, the course teaches you the basics of OOPs, like inheritance.]</p><h4>Resources I’ve Used In the Past But Didn’t Work For Me [At First]</h4><p>✨ I want to use this section to emphasize that sometimes even though it’s a lot of people’s recommendations but doesn’t mean it works for you✨</p><ol><li><strong>Colt Steele’s JavaScript Algorithms and Data Structures Masterclass</strong></li></ol><p>2 years ago, I was introduced to Colt Steele’s <a href="https://www.udemy.com/course/js-algorithms-and-data-structures-masterclass/">JavaScript Algorithms and Data Structures Masterclass</a>. Apparently it works for a lot of bootcamp grad because everyone recommends it. But I realized the course is not for me. I will not disregard the fact that Colt’s a great instructor. But the curriculum mainly consists of starter code, rather than discussing how we can apply these new concepts, it frustrated me as a learner.</p><p><strong>To give a more concrete example, there’s a strong emphasis on the comparison between Linked List vs Array in terms of complexity efficiency. But with JavaScript, it’s easier to use an array over linked list, because in order to implement linked list, you have to write a </strong><strong>Node class from scratch.</strong> Linked list can be easily imported as a library in other languages, like Python and Java. But that’s not the case for JavaScript. (Which, by the way, this is something I learned from the Georgia Tech’s CS course). From that point, I found it hard to continue the course and I know I need to find something else to help me learn all these new knowledges.</p><p>However, if looking for JavaScript starter code for specific data structures, this course is a go-to resource.</p><p><strong>2. Educative.io’s </strong><a href="https://www.educative.io/courses/grokking-coding-interview-patterns-javascript"><strong>Grokking Coding Interview Patterns in JavaScript</strong></a></p><p>Educative.io has a lot of amazing courses. Not just one, but a few people recommended this when I first started learning DSA. As an absolute beginner at that time, this was so overwhelming.</p><p>Just a disclaimer that now I have grinded Leetcode for a couple months and have exposed myself to different types of data structures and questions, I think I am a lot more comfortable to take this course to help practice recognizing patterns. But I do not recommend this for beginners at all.</p><h4>How I Keep Myself Productive</h4><p>Like I indicated in the title, this is a journey. Some people can pick up DSA really fast and learn the basics within 3 months. <strong>But for me, even with a little bit prior knowledge of DSA, it took me around 2 months to slowly be able to recognize what data structures and patterns I should apply to different question.</strong> I still have a lot to improve and learn. At the same time, since I have made a decision not to work on any new projects or learn new framework, I have dedicated <strong>at least 7–8 hours per day [strictly on weekdays]</strong> to focus on learning new data structure, in the meantime, I would do my best to do at least 2 Leetcode Medium level questions per day with a mix of 1–2 Easy level questions. I’ll spend maybe 45min — 1hour on one medium level question and 15–30 min on an easy level question.</p><p>Note 1: The 7–8 hours include the time I spend on the 2 online courses that I am taking simultaneously — the two that I stated above.</p><p>Note 2: I’d like to acknowledge the privilege that I have without having to worry about any major responsibilities, and I understand not everyone can afford spending so much time dedicating so much time per day to study. This depends on your learning style as well.</p><p><strong>Tip 1: Set Up a To Do List For The Week</strong></p><p>To aid and help organize my study, I use a productivity tool, called <a href="https://todoist.com/app/today">Todoist</a> that I found a month ago to help organize my learning materials.</p><p>Here’s a screenshot of my typical week:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yrWX2-0twxDc1RhArEj4YQ.png" /></figure><p>What I love about this tool is that you’re able to visualize what you have to finish in the week and they have this very satisfying sound when you ✅ the finished task.</p><p><strong>Tip 2: Pomodoro Timer</strong></p><p>I recently found this <a href="https://www.youtube.com/watch?v=Qqvm4NmRIiI&amp;t=3135s">amazing pomodoro timer</a> on Youtube, if you’re a cat person, this timer is for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WWrtdG7RVfMcVt6jnooaHg.png" /><figcaption>Thumbnail of the channel, @<a href="https://www.youtube.com/@PomodoroCat">Pomodoro Cat</a></figcaption></figure><p><strong>Tip 3: Make Use Of Spreadsheet</strong></p><p>I got this advice from a few friends in separate time periods. It’s like words of MANY mouths. So I’m like, “Alright, I guess I’ll start mine too”. And it works like wonder.</p><p>I copied and pasted all the questions from Neetcode 150 on the spreadsheet. Once I finish the questions, I would write down how I solve the questions, regardless if I did it myself, with some help from the discussion section, or had to rely on reading the solution to help me understand. I also have a revisit tab, so I know which question I want to revisit in the near future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3UOQnCmbOG-bzPPdDqB-0A.png" /><figcaption>My Leetcode Questions Tracker Spreadsheet</figcaption></figure><p><strong>Tip 4: Don’t forget to take care of your body</strong></p><p>There’s a saying that your body is your temple. To prevent getting burned out, aside making use of the to do list and the pomodoro timer, <strong>I ensure to spend at least 2 hours after work hours to exercise and go out for a walk</strong> [even better if you have set up a goal — for instance, 8000 steps or 4 miles per walk].</p><h4>Wrap Up</h4><p>At the end of the day, this is all about consistency and learn how to balance between learning new and revisiting old concepts. But the question is always on how do you even start? What works for me is that I found a website (i.e. Structy) that teaches me the easiest way to understand a concept and use the concept and recognize patterns within questions. From there, I slowly figured out what other resources that aid my study and learning + being consistent and constantly revisiting concepts help me loads. As I’ve mentioned, I still have a long way to go and I still struggle here and there. However, I found a way to effectively study and practice DSA. This is why I am sharing my journey here in this article.</p><p>For those who feel unmotivated to grind Leetcode, I truly hope this article at least gives you slight hope that it is possible to get better at Leetcode. I would like to offer a hand if you want more advice. I have asked for help countless times and I couldn’t be more grateful for my friends who have offered their piece of advice. And now I want to do the same for the community. Please feel free to connect me via <a href="https://www.linkedin.com/in/megan-s-lo">Linkedin</a>, and attach a personalized message letting me know that you come from this article.</p><p>Last but not least, happy coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*0sNh30H62BOaupAi" /><figcaption>Resource: GIPHY</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a60137afbdc9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Interview Edition: Design a REST API as a Junior Engineer]]></title>
            <link>https://meganslo.medium.com/interview-edition-design-a-rest-api-as-a-junior-engineer-450b7586c64f?source=rss-963906d24739------2</link>
            <guid isPermaLink="false">https://medium.com/p/450b7586c64f</guid>
            <category><![CDATA[tech-interview]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Megan Lo]]></dc:creator>
            <pubDate>Mon, 21 Nov 2022 16:31:33 GMT</pubDate>
            <atom:updated>2022-11-23T00:27:59.768Z</atom:updated>
            <content:encoded><![CDATA[<h4>Step-by-Step Guide on Designing a REST API Along With My Interview Experience</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*FCRcgsXLU3ylgu8TesFMkg.gif" /></figure><h4>Introduction</h4><p>Hello! I am writing this purely from my interview experience when I was asked to design an API as a junior level candidate. And no worries, it is not as complicated as you thought and having the fundamental knowledge of an API is the key here. I am here to provide steps which hopefully can make your process at ease, and potentially a template for you if you were ever asked a similar design question.</p><h4>Table of Content</h4><ul><li><a href="#01c2">Introduction</a></li><li><a href="#bb8b">Fundamentals You Should Know</a></li><li><a href="#6e9e">Prompt You’re Given</a></li><li><a href="#8ab9">Step 1: List All The Potential User Stories/Requirements</a></li><li><a href="#f119">Step 2: Associating actions/HTTP Verbs with User Stories</a></li><li><a href="#1d63">Step 3: Request/Response Cycle + Routes + Response Body Content</a></li><li><a href="#b47a">Step 4: Other Things Interviewers Might Ask About</a></li><li><a href="#b47a">Conclusion</a></li></ul><h4>Fundamentals You Should Know</h4><p>Before we dive into the real stuff, here’s what you should know:</p><ul><li><strong>HTTP Methods</strong> (i.e. GET, POST, PUT/PATCH, DELETE)</li><li><strong>Request/Response Cycle </strong>👈 I’d suggest to use this as the backbone when thinking about the correlations between the criteria you’re given and the actions/HTTP methods</li></ul><p>[Recommended Resource: <a href="https://www.codecademy.com/article/request-response-cycle-static">Request-Response Cycle I</a> by CodeCademy]</p><ul><li><strong>Routes (The “name” you use to access endpoints)</strong></li><li><strong>Other jargons: endpoints, parameters, arguments, request URL, server’s response</strong></li><li><strong>REST Design Rules</strong> (ex: routes should be named with a plural noun and not started with verb, like /posts , not /getPosts )</li><li><strong>HTTP Status Code</strong></li><li><strong>Architecture Difference</strong> (ex: GraphQL, REST, SOAP)</li></ul><p>Note: In my opinion, as a junior, this is the least you should care about. Just focus on whichever you know best, in this case for the sake of this article would be REST.</p><ul><li><strong>Bonus: Schema/Model</strong></li></ul><p>Note: This will help when thinking about the relationships between models [one-to-many? many-to-many?]. However, in my experience, the interviewers would have already stated.</p><ul><li><strong>Additional Bonus: Logic </strong>[I had to do some pseudocode]</li><li><strong>Additional Bonus: Error Handling (Understanding the HTTP status code should be good enough as a junior)</strong></li></ul><p>With all these in mind, these will help navigate your thought process and don’t forget to think out loud.</p><h4>Prompt You’re Given</h4><pre>Design an API for a to-do list app.<br>Note: User is already authenticated.</pre><p>It seems relatively simple and straightforward, right? When I was reading tips for system design interviews, it is quite common that the prompt is meant to be quite vague and you’re expected to ask questions. And in order for me to understand the prompt better and make sure the interviewers and I are in the same page…</p><p><strong>Clarification questions you may have along the way:</strong></p><ul><li><strong>Will there be one list or multiple lists?</strong></li><li>Ans: Just one (i.e. there will be no list_id)</li><li><strong>Do we have to grab any specific user ID? (Thinking for the schema)</strong></li><li>Ans: Since the user is already authenticated, we can disregard user_id.</li><li><strong>As user, can I click on the task and check the details of the task? (Related to the feature itself)</strong></li><li>Ans: Yes, that is indeed an option.</li></ul><p>Note: I did not come up with these questions in the beginning. I found it more efficient to ask more effective and smarter questions when I was working on the design, so I can get clarifications in the meantime.</p><h4>Step 1: List All The Potential User Stories/Requirements</h4><ul><li>As user, I can read all the tasks that I create.</li><li>As user, I can create tasks.</li><li>As user, I can update a task.</li><li>As user, I can delete a task.</li></ul><h4>Step 2: Associating actions/HTTP Verbs with User Stories</h4><p>Choose the following: GET, POST, PUT, DELETE</p><ul><li><strong>As user, I can read all the tasks that I create.</strong></li></ul><p>Since we are listing the tasks only, GET seems like an appropriate HTTP method.</p><ul><li><strong>As user, I can create tasks.</strong></li></ul><p>POST is the HTTP method which we will use to create tasks.</p><ul><li><strong>As user, I can update a task.</strong></li></ul><p>PUT and PATCH seems like the appropriate HTTP method. Also, it might be a good time to bring up and discuss with the interviewers if they have a preference using PUT vs PATCH, since PUT would update the entire resource and PATCH would only partially update the resource. This also demonstrate your knowledge in HTTP methods.</p><p>Note: If interested, feel free to check out this article I wrote more than a year ago: <a href="https://dev.to/mehmehmehlol/put-vs-patch-put-vs-post-56i9">PUT vs PATCH &amp; PUT vs POST</a> 😃</p><p>Last but not least,</p><ul><li><strong>As user, I can delete a task.</strong></li></ul><p>As obvious as it sounds, DELETE would be our go-to method in this case.</p><p>Now that we have identified all the methods, let’s dive into the <strong>request/response cycle.</strong></p><h4>Step 3: Request/Response Cycle + Routes + Body Content</h4><p>Note: This part is my favorite part of the interview. Not gonna lie, this part is something that I have overseen in the past couple years when building web applications. I finally understood what this means in a deeper level.</p><p>After we identify the HTTP methods, it’s time to think about <strong>what the client requests</strong> and <strong>what the server’s response would be like</strong>.</p><p>At this point, the interviewers gave me some hints by asking what the *request URL* is.</p><p>Stating the obvious that we are getting tasks, so tasks would be our endpoint name.</p><ul><li><strong>As user, I can read all the tasks that I create.</strong></li></ul><pre>// GET<br>// Request URL: /tasks</pre><p>After we identify the request URL, what would the server’s response be? A server’s response is consisted of header, body and status code. Usually, we are more interested in seeing the body/data. It might also be a good idea to bring up the HTTP status code as additional bonus point.</p><p>Questions that may come up (or hints):</p><ul><li><strong>Which format do we want the server to respond with?</strong></li><li>Ans: Since JSON is more common, we’d receive a JSON format response.</li><li><strong>What kind of stuff can a user see from one specific task?</strong></li><li>Ans: A user can see the date that the task is created, the title of the task and the content of the task.</li></ul><pre>// GET<br>// Request URL: /tasks<br>// Response data:<br>[<br>  {<br>    id: 1,<br>    title: &quot;task 1&quot;,<br>    content: &quot;this is task 1&quot;,<br>    &quot;date_submitted&quot;: &quot;2022-10-18 10:00AM&quot;<br>  },<br>  {<br>    id: 2,<br>    title: &quot;task 2&quot;,<br>    content: &quot;this is task 2&quot;,<br>    &quot;date_submitted&quot;: &quot;2022-10-19 10:00AM&quot;<br>  },<br>]<br>// Response Status Code:<br>// If successful, 200 OK<br>// If request resource not found, 404</pre><ul><li><strong>Bonus Question: As user, can I click on the task and check the details of the task?</strong></li><li>Ans: Yes.</li></ul><pre>// GET<br>// Request URL: /tasks/:id (ex: /tasks/1)<br>// Response data:<br>  {<br>    id: 1,<br>    title: &quot;task 1&quot;,<br>    content: &quot;this is task 1&quot;,<br>    &quot;date_submitted&quot;: &quot;2022-10-18 10:00AM&quot;<br>  }<br>// Response Status Code:<br>// If successful, 200 OK<br>// If request resource not found, 404 Not Found</pre><ul><li><strong>As user, I can create tasks.</strong></li></ul><pre>// POST<br>// Request URL: /tasks<br>// Request body:<br>{<br>  id: 3,<br>  title: &quot;task 3&quot;,<br>  content: &quot;this is task 3&quot;,<br>  &quot;date_submitted&quot;: &quot;whichever date and time when you submit - this normally shouldn&#39;t be hardcoded on your end.&quot;<br>}<br>// Response data:<br>// null<br><br>// Response Status Code:<br>// If successfully created, 201 Created<br>// If request resource not found, 404 Not Found</pre><ul><li><strong>As user, I can update a task.</strong></li></ul><pre>// PUT<br>// Request URL: /tasks/:id (ex: /tasks/1)<br>// Request body:<br>{<br>  id: 1,<br>  title: &quot;NOT task 1&quot;,<br>  content: &quot;this is NOT task 1&quot;<br>  &quot;date_submitted&quot;: &quot;2022-10-18 10:00AM&quot;<br>}<br><br>// Response body: <br>// Should return the data that was just updated<br><br>// Response status code:<br>// If successful, 200 OK or 204 No Content or 201 for Created Success<br>// If task not found, 404</pre><p>Last but not least,</p><ul><li><strong>As user, I can delete a task.</strong></li></ul><pre>// DELETE<br>// Request URL: /tasks/:id (ex: /tasks/1)<br>// Request body:<br>{<br>  id: 1,<br>  title: &quot;NOT task 1&quot;,<br>  content: &quot;this is NOT task 1&quot;<br>  &quot;date_submitted&quot;: &quot;2022-10-18 10:00AM&quot;<br>}<br><br>// Response Body: null<br><br>// Response status code:<br>// If successful, 200 OK or 204 No Content <br>// If task not found, 404 Not Found</pre><p>Reference from this <a href="https://stackoverflow.com/questions/2342579/http-status-code-for-update-and-delete">Stack Overflow post</a></p><p><strong>💡Quick disclaimer on HTTP status code</strong>:</p><p>When I was doing research on the HTTP status code for different HTTP methods, there are multiple status code that could be returned depending on the operations. The ones I provided above is more of a baseline and there are a lot more to discuss.</p><p>There are other things like different parameters (ex: headers). But in my experience, understanding the basics of what kind of data the client is requesting versus what the server returns as response is more important.</p><h4><strong>Step 4: Other Things Interviewers Might Ask About</strong></h4><p>The prompt I provided above is relatively simple and your interviewers might add some additional requirements. For instance,</p><ul><li><strong>What happens if there is already a duplicated version of the new task that a user is requesting?</strong></li></ul><p>You might be asked to write some logic/pseudocode to reflect that.</p><ul><li><strong>What are the arguments that we are providing to users so they can input and be part of the request?</strong></li></ul><p>You might also get asked to write a <strong>schema</strong>. You might have already seen this if you have studied for system design interviews, or if you have worked with database, like SQL. If it’s difficult for you to brainstorm, think of it by referring back to our request/response cycle.</p><ul><li><strong>What kind of things we want to include in the response body?</strong></li></ul><p>Referring back to our tasks example, here’s a possible schema:</p><pre>task_id         INTEGER PRIMARY_KEY<br>title           VARCHAR<br>content         VARCHAR<br>date_submitted  VARCHAR</pre><p>Something like that!</p><h4>Conclusion</h4><p><strong>Ultimately, it is an open-ended conversation between you and your interviewer.</strong> Cliche, I know. BUT!</p><p>With the fundamental knowledge you have, not only it helps you navigate around this, but also it demonstrates how much you know to the interviewer. I personally am not kind of person who can come up questions in the first place after hearing the prompt, but as my interviewer and I are navigating the prompt and writing out possible solutions, questions start to come easy and also helps me understand what the interviewers are looking for. [Another factor is that it also depends on the interviewer’s personality/work style too.] As a junior, companies don’t expect as much as they would expect from a senior. So definitely do your best and show them what you got!</p><p>Hope this article helps — doesn’t matter if you are prepping for something similar, you already finished yours and curious how other junior candidates approach this question, or you’re just being a Curious George!</p><p><strong>For folks who’s curious about the outcome of the interview, I received positive feedback but the role had to be on hold due to hiring freeze in the company.</strong></p><p>Please feel free to comment and let me know what else I might be missing in this article!</p><p>Last but not least,</p><p>Happy Coding and here’s a GIF of Curious George being curious!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*tVHsOuE4kTB5jDYT.gif" /></figure><h4>Additional Resource</h4><ul><li>To understand the request/response of an API, I’d recommend playing around with this swagger page:</li></ul><p><a href="https://petstore.swagger.io/#/">Swagger UI</a></p><ul><li>If you are familiar with Axios, you might be interested in what kind of things Axios’ request config look like:</li></ul><p><a href="https://axios-http.com/docs/req_config">Request Config</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=450b7586c64f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python 101 for JavaScript Developers (Part II — List/Array Methods Edition)]]></title>
            <link>https://meganslo.medium.com/python-101-for-javascript-developers-part-ii-list-array-methods-edition-7064a5df6e07?source=rss-963906d24739------2</link>
            <guid isPermaLink="false">https://medium.com/p/7064a5df6e07</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Megan Lo]]></dc:creator>
            <pubDate>Thu, 07 Jul 2022 06:39:27 GMT</pubDate>
            <atom:updated>2022-07-07T06:49:20.937Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python 101 for JavaScript Developers (Part II — List/Array Methods Edition)</h3><h4>10 MORE Python things JavaScript developers need to know + BONUS!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*6ZeofKXMe9gzV8T_4_xVXg.png" /></figure><h4>Intro</h4><p>Hello! A little over a year ago, I wrote <a href="https://python.plainenglish.io/python-101-for-javascript-developers-e7f1987f825e">Part I</a> (not known as Part I back then, but now it’s officially Part I!) as I went on my Python journey. And guess what, I stopped learning as many things had happened [that includes getting employed at my current job!]. Now, I am back to my Python journey with more JavaScript experience. In Part I, I mainly focused on <strong>syntax</strong>; in this article, I’d like to focus on <strong>methods</strong>. Let’s get to them!</p><h4>Recall</h4><p>In Part I, I have briefly covered List in Python and Array in JavaScript (#15). They are pretty much the same but different ways of calling something inside a []. For this article, I am very excited to focus on built-in methods for Python and JavaScript respectively. There are a few methods that are quite mind-blowing [Look out for mind-blowing emoji 🤯]and I wish those also exist in JavaScript!</p><h4>Table of Content</h4><ul><li><a href="#894e"><strong>10 differences between Python and JavaScript</strong></a></li></ul><ol><li><a href="#dd31">Adding items to list/array:</a><a href="#dd31">append() vs </a><a href="#dd31">push()</a></li><li><a href="#3755">Removing specific items: </a><a href="#3755">remove() vs </a><a href="#3755">pop()/shift()/splice()/map()…</a></li><li><a href="#6366">Removing items II: </a><a href="#6366">pop() vs </a><a href="#6366">pop()</a></li><li><a href="#1110">Finding the length of a list/array: </a><a href="#1110">len() vs </a><a href="#1110">length()</a></li><li><a href="#a899">Counting the occurrences of a specific item: </a><a href="#a899">count() vs ???</a></li><li><a href="#32bb">Negative Indexes: </a><a href="#32bb">&lt;array&gt;[-1]</a></li><li><a href="#9f82">Adding elements to a certain index: </a><a href="#9f82">insert() vs </a><a href="#9f82">splice()</a></li><li><a href="#9559">Slicing an array: </a><a href="#9559">&lt;array&gt;[start:stop] vs </a><a href="#9559">splice()/slice()</a></li><li><a href="#b7db">Printing an array with a sequence of numbers: </a><a href="#b7db">range() vs </a><a href="#b7db">fill()/</a><a href="#b7db">map()/</a><a href="#b7db">for loops</a></li><li><a href="#2d07">Sorting: </a><a href="#2d07">sort()/</a><a href="#2d07">sorted() vs </a><a href="#2d07">sort()</a></li></ol><ul><li><a href="#09d7"><strong>Bonus</strong></a></li></ul><h4>10 differences between Python and JavaScript</h4><ol><li><strong>Adding items to list/array:</strong><strong>append() vs </strong><strong>push()</strong></li></ol><p>I remembered when I was reading some JavaScript articles, append is a word that got thrown around a lot while that keyword doesn’t exist in JavaScript. Essentially, both append() and push() have very similar syntax, which you includes the element you want to push to the list/array inside the parenthesis.</p><p>Code Sample:</p><pre># Python<br>my_list = [&quot;python&quot;, &quot;javascript&quot;, &quot;c++&quot;]<br><strong>my_list.append(&quot;ruby&quot;)</strong><br>print(my_list)<br># [&quot;python&quot;, &quot;javascript&quot;, &quot;c++&quot;, &quot;ruby&quot;]</pre><pre>// JavaScript<br>const myList = [&quot;python&quot;, &quot;javascript&quot;, &quot;c++&quot;];<br><strong>myList.push(&quot;ruby&quot;);</strong><br>console.log(myList);<br>// [&quot;python&quot;, &quot;javascript&quot;, &quot;c++&quot;, &quot;ruby&quot;]</pre><p>(<a href="#b408">Back to “You Made It!” section</a>)</p><p><strong>2. </strong>🤯<strong>Removing specific items: </strong><strong>remove() vs </strong><strong>pop()/shift()/splice()/map()...</strong></p><p>Note: pop() is also one of the Python built-in list methods, which we would discuss in the next point. [so as map(), but will not cover in this guide.]</p><p>This is one of the Python built-in methods that blows my mind. In JavaScript, if we want to remove a specific item, we will have to iterate the array or write multiple lines to retrieve that item to remove a specific item [<a href="https://love2dev.com/blog/javascript-remove-from-array/">9 Ways to Remove Elements From A JavaScript Array — Plus How to Safely Clear JavaScript Arrays</a>]. That’s not the case in Python! If you want to remove banana , Python’s like, “LET’S REMOVE IT!” [Sorry Minions!!!]</p><p>Code Sample:</p><pre># Python<br>my_grocery_list = [&quot;lettuce&quot;, &quot;garlic&quot;, &quot;banana&quot;, &quot;apple&quot;]<br><strong>my_grocery_list.remove(&quot;banana&quot;)<br></strong>print(my_grocery_list)<br># [&quot;lettuce&quot;, &quot;garlic&quot;, &quot;apple&quot;]</pre><pre>// JavaScript [One of the methods to remove: `filter`]<br>const myGroceryList = [&quot;lettuce&quot;, &quot;garlic&quot;, &quot;banana&quot;, &quot;apple&quot;];<br><strong>const filteredList = myGroceryList.filter(ele =&gt; ele !== &quot;banana&quot;);</strong><br>console.log(filteredList);<br>// [ &#39;lettuce&#39;, &#39;garlic&#39;, &#39;apple&#39; ]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*BRA68KIJZaTOr_ka.gif" /><figcaption>Resource: GIF Tenor</figcaption></figure><p>Sorry Stuart! :(</p><p>(<a href="#b408">Back to “You Made It!” section</a>)</p><p><strong>3. </strong><strong>pop() vs </strong><strong>pop()</strong></p><p>As mentioned above, we will talk about the usage difference for pop() for both Python and JavaScript respectively.</p><p>While in JavaScript, pop() means removing the last element from the array. Same goes to Python, however, with a small twist! You have an additional option to indicate the index of the element you want to remove. [Quick reminder: remove() takes in string].</p><pre># Python<br>minions = [&quot;Bob&quot;, &quot;Kevin&quot;, &quot;Stuart&quot;]</pre><pre># remove the last element<br>minions.pop() #eeek sorry Stuart again!!<br>print(minions)<br># [&#39;Bob&#39;, &#39;Kevin&#39;]</pre><pre># OR, remove a specific element by specifying the index<br>minions.pop(1) # removing the 2nd element<br>print(minions)<br># [&#39;Bob&#39;, &#39;Stuart&#39;]</pre><pre>// JavaScript<br>const minions = [&quot;Bob&quot;, &quot;Kevin&quot;, &quot;Stuart&quot;];</pre><pre>// You can only remove the last element with pop()<br>minions.pop();<br>console.log(minions);<br>// [ &#39;Bob&#39;, &#39;Kevin&#39; ]</pre><p>(<a href="#b408">Back to “You Made It!” section</a>)</p><p><strong>4. Finding the length of a list/array: </strong><strong>len() vs </strong><strong>length</strong></p><p>This is pretty straightforward, but as a JavaScript developer, I think I would always accidentally write length() instead of len(). But yes, as you can already guess from the name, both methods returns the number of items in an object.</p><p>Code Sample:</p><pre># Python<br>top_gun_candidate = [&quot;Iceman&quot;, &quot;Maverick&quot;, &quot;Goose&quot;, &quot;Hollywood&quot;]<br>len(top_gun_candidate) # 4</pre><pre>// JavaScript<br>const topGunCandidate = [&quot;Iceman&quot;, &quot;Maverick&quot;, &quot;Goose&quot;, &quot;Hollywood&quot;];<br>const topGunLength = topGunCandidate.length;<br>console.log(topGunLength);<br>// 4</pre><p>(<a href="#b408">Back to “You Made It!” section</a>)</p><p><strong>5. Counting the occurrences of a specific item: </strong><strong>count() vs using </strong><strong>for loop [C’mon JavaScript!]</strong></p><p>This built-in list method is only available to Python, not JS. count() as it’s stated in the name that it counts the occurrences of a specific item in a list whilst in JavaScript, we’ll have to use for loop to do so.</p><p>Code Sample — Oh, wait! Looks like the minions are voting who’s going to be their leader! We got 3 candidates — Stuart, Bob, Kevin. Let’s see who got the most votes!</p><pre># Python<br>vote_for_minion_leader = [&quot;Stuart&quot;, &quot;Bob&quot;, &quot;Stuart&quot;, &quot;Kevin&quot;, &quot;Stuart&quot;, &quot;Kevin&quot;, &quot;Bob&quot;, &quot;Bob&quot;, &quot;Stuart&quot;, &quot;Kevin&quot;]</pre><pre># Vote for Stuart<br>stuart_vote = vote_for_minion_leader.count(&quot;Stuart&quot;)<br>print(stuart_vote) # 4</pre><pre># Vote for Bob<br>bob_vote = vote_for_minion_leader.count(&quot;Bob&quot;)<br>print(bob_vote) # 3</pre><pre># Vote for Kevin<br>kevin_vote = vote_for_minion_leader.count(&quot;Kevin&quot;)<br>print(kevin_vote) # 3</pre><pre># Ah, looks like we have a winner! Congratulations to Stuart!</pre><pre>// JavaSript - have to iterate with for loop<br>const voteMinionLeader = [&quot;Stuart&quot;, &quot;Bob&quot;, &quot;Stuart&quot;, &quot;Kevin&quot;, &quot;Stuart&quot;, &quot;Kevin&quot;, &quot;Bob&quot;, &quot;Bob&quot;, &quot;Stuart&quot;, &quot;Kevin&quot;];</pre><pre>const voteCount = {};</pre><pre>for (let i = 0; i &lt; voteMinionLeader.length; i++) {<br>  let candidate = voteMinionLeader[i];<br>  if (!voteCount[candidate]) {<br>    voteCount[candidate] = 1;<br>  } else {<br>    voteCount[candidate] += 1;<br>  }<br>}<br>console.log(voteCount);<br>// { Stuart: 4, Bob: 3, Kevin: 3 }</pre><p>Quick sidebar 🍸: You might notice I am using semicolons in JavaScript. You don’t have to use semicolons in JavaScript. Although it’s my personal strong preference to use semicolons, this is also a way to distinguish JavaScript syntax and Python syntax for this article. 😃</p><p>(<a href="#b408">Back to “You Made It!” section</a>)</p><p><strong>6. Wait </strong>🤯<strong>, negative indexes is a thing??? </strong><strong>&lt;array&gt;[-1] vs ????</strong></p><p>The only way to get the last element of the array in JavaScript without knowing how many items is &lt;array&gt;[&lt;array&gt;.length — 1]. However, with Python, you can use negative index to retrieve the last element or second last or third last… and so on… elements! AH-MAZING!</p><pre># Python<br>call_sign_two = [&quot;Hangman&quot;, &quot;Rooster&quot;, &quot;Payback&quot;, &quot;Fanboy&quot;]</pre><pre># Retrieve the last element<br>last_element = call_sign_two[-1]<br>print(last_element) <br># &#39;Fanboy&#39;</pre><pre># Retrieve the second last element<br>second_last_element = call_sign_two[-2]<br>print(second_last_element)<br># &#39;Payback&#39;</pre><pre>// JavaScript<br>const callSignTwo = [&quot;Hangman&quot;, &quot;Rooster&quot;, &quot;Payback&quot;, &quot;Fanboy&quot;];<br>// Retrieve the last element<br>const lastElement = callSignTwo[callSignTwo.length - 1];<br>console.log(lastElement);<br>// Fanboy</pre><p>Pretty cool, right?? Keep this in mind — we will revisit negative indexes in the next few points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/0*6JQNwerCUPawj0Tq.gif" /></figure><p>Speaking of cool 👆🏻</p><p>(<a href="#b408">Back to “You Made It!” section</a>)</p><p><strong>7. Adding elements to a certain index: </strong><strong>insert() vs </strong><strong>splice()</strong></p><p>Note: splice() is one of Python built-in methods, but for string. However, splice() is only available to JavaScript as an array method.</p><p>If you want to add an elements anywhere in a(n) list/array, insert() will be your method in Python and splice() for JavaScript. There’s slight difference with Python and JavaScript. Let’s see how it’s done!</p><p>Code Sample [Slight spoiler alert!]:</p><pre># Python<br>top_gun_two = [&quot;Maverick&quot;, &quot;Rooster&quot;, &quot;Phoenix&quot;, &quot;Bob&quot;]</pre><pre># Hangman to the rescue, let&#39;s insert &quot;Hangman&quot; in between Rooster and Phoenix<br>top_gun_two.insert(2, &quot;Hangman&quot;)<br>print(top_gun_two)<br># [&#39;Maverick&#39;, &#39;Rooster&#39;, &#39;Hangman&#39;, &#39;Phoenix&#39;, &#39;Bob&#39;]</pre><pre>// JavaScript<br>const topGunTwo = [&quot;Maverick&quot;, &quot;Rooster&quot;, &quot;Phoenix&quot;, &quot;Bob&quot;];</pre><pre>// inserts at index 2 without replacing anything<br>topGunTwo.splice(2, 0, &quot;Hangman&quot;); // []<br>console.log(topGunTwo);<br>// [ &#39;Maverick&#39;, &#39;Rooster&#39;, &#39;Hangman&#39;, &#39;Phoenix&#39;, &#39;Bob&#39; ]</pre><pre>// replaces 1 element at index 3 (i.e. &quot;Phoenix&quot;) with &quot;Fanboy&quot;<br>topGunTwo.splice(3, 1, &quot;Fanboy&quot;) // [ &#39;Phoenix&#39; ]<br>console.log(topGunTwo);<br>// [ &#39;Maverick&#39;, &#39;Rooster&#39;, &#39;Hangman&#39;, &#39;Fanboy&#39;, &#39;Bob&#39; ]</pre><p>Despite the slight complexity, I like JavaScript splice method more as you can replace and insert new element whilst you can only insert new element in Python.</p><p>Quick sidebar 🍸: splice() has more functionalities than what I demonstrated above. Please refer to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice">MDN</a> for more usages. Also, splice() is immutable, i.e. it will modify the array as demonstrated above. If you’re looking for a method that doesn’t modify your array, slice() will be the method!</p><p>(<a href="#b408">Back to “You Made It!” section</a>)</p><p>And speaking of slice…</p><p><strong>8. Slicing an array: </strong><strong>&lt;array&gt;[start:stop] vs </strong><strong>splice()/slice()</strong></p><p>Note: slice() is also one of the Python built-in method (Check out <a href="https://www.programiz.com/python-programming/methods/built-in/slice">here</a>), but will not discuss this in this article.</p><p>Python’s &lt;array&gt;[start:stop]<strong> </strong>— start: the start of the index and end:which index you want to stop the slice, i.e. does not include in the slice. slice() in both languages does not mutate the original array/list.</p><p>Code Sample:</p><pre># Python<br>dog_breeds = [&quot;german shepherd&quot;, &quot;shiba inu&quot;, &quot;labrador&quot;, &quot;golden retriever&quot;, &quot;greyhound&quot;, &quot;irish doodle&quot;, &quot;beagle&quot;]</pre><pre>most_favorite_dog_breeds = dog_breeds[1:4]<br>print(most_favorite_dog_breeds)<br># [&#39;shiba inu&#39;, &#39;labrador&#39;, &#39;golden retriever&#39;]</pre><pre># or leave the the right hand side of the `:` empty, it will slice from which index you indicate to the end of the list!<br>from_third_to_end = dog_breeds[2:]<br>print(from_third_to_end)<br># [&#39;labrador&#39;, &#39;golden retriever&#39;, &#39;greyhound&#39;, &#39;irish doodle&#39;, &#39;beagle&#39;]</pre><pre># vice versa if leaving the left hand side empty<br>first_three = dog_breeds[:3]<br>print(first_three)<br># [&#39;german shepherd&#39;, &#39;shiba inu&#39;, &#39;labrador&#39;]</pre><p>Remember we talked about negative indexes at #6? It’s time to revisit!</p><p>&lt;array&gt;[-n] will retrieve the n-th last element of the list. This can also be applied here! 🤯</p><pre>dog_breeds = [&quot;german shepherd&quot;, &quot;shiba inu&quot;, &quot;labrador&quot;, &quot;golden retriever&quot;, &quot;greyhound&quot;, &quot;irish doodle&quot;, &quot;beagle&quot;]</pre><pre># negative index slice? LET&#39;S GO<br># from the third last element to the end<br>last_three = dog_breeds[-3:]<br>print(last_three)<br># [&#39;greyhound&#39;, &#39;irish doodle&#39;, &#39;beagle&#39;]</pre><pre># from the third last element to the second last element<br>third_and_second_last = dog_breeds[-3:-1]<br>print(third_and_second_last)<br># [&#39;greyhound&#39;, &#39;irish doodle&#39;]</pre><p>Bam! Things JavaScript cannot do! I’ve already demonstrated splice() in the previous point, so not going to show any code example.</p><p>(<a href="#b408">Back to “You Made It!” section</a>)</p><h4>Mid-to-end-article break</h4><p>We’re <strong>80%</strong> into this article. Hope y’all are feeling good at this point! I would always recommend you all to create your own array/list and try out these methods on your own! Feel free to call me out if some of these examples I put here are giving errors on your console. I am also testing the code on my end as well!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*q4mkxqxXFC2nmHMnMY4fDw.png" /><figcaption>Screenshot from my terminal</figcaption></figure><p><strong>9. Printing an array with a sequence of numbers: </strong><strong>range() vs </strong><strong>fill/</strong><strong>map()/</strong><strong>for loops</strong></p><p>This range() feature unfortunately does not exist in JavaScript. That also explains why Python is a more popular language in data science/data analytics. To achieve that in JavaScript, you’ll have to use for loop or some engineers from a <a href="https://stackoverflow.com/questions/3751520/how-to-generate-sequence-of-numbers-chars-in-javascript">Stack Overflow</a> post suggested to use Array(n).fill().map(some function) .</p><p>I am going to break down the range() syntax real quick:</p><pre>range(start, stop, step)</pre><p>start : start at 0 by default;</p><p>stop: stop at any number, which does not include;</p><p>step: the increment from the previous element</p><p>Code Sample:</p><pre># Python </pre><pre># this will print from 0 to 9<br>my_list = range(10)<br>print(my_list)<br># range(0, 10)</pre><p>Wait, why is it returning range(0, 10) , but not a list?? Well because range() creates a range object. If we want to create a list, there’s a built-in method called list , which would “translate” an object to a list we are familiar with.</p><p>Let’s try again!</p><pre># Python<br>print(list(my_list))<br># [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]</pre><pre># Let&#39;s print from 2 to 10!<br>starting_from_two = range(2, 11)<br>print(list(starting_from_two))<br># [2, 3, 4, 5, 6, 7, 8, 9, 10]</pre><pre># Do you have a favorite number? 7 is my fav :) Let&#39;s print from 7 to...70 with an increment of 7!<br>increment_of_7 = range(7, 77, 7)<br>print(list(increment_of_7))<br># [7, 14, 21, 28, 35, 42, 49, 56, 63, 70]</pre><p>Quick sidebar 🍸: If you want to check the length of your range() , you don’t have to call list .</p><pre>increment_of_7 = range(7, 77, 7)<br>length_of_seven = len(increment_of_7)<br>print(length_of_seven) # 10</pre><pre>increment_of_7_diff_5 = range(7, 77, 5)<br>length_of_seven_diff_five = len(increment_of_7_diff_5)<br>print(length_of_seven_diff_five) # 14</pre><p>(<a href="#b408">Back to “You Made It!” section</a>)</p><p><strong>10. Sorting an list/array: </strong><strong>sort()/sorted() vs </strong><strong>sort()</strong></p><p>There’s a slight difference between sort() and sorted() in Python. However, I will not dive deep in this article. Check out this great <a href="https://www.geeksforgeeks.org/python-difference-between-sorted-and-sort/">article</a> from GeeksForGeeks! But no sweat, I will still demonstrate in this article 😄</p><p>In general, sorting is one of the basic built-in methods for if not all but almost all programming languages. They work quite similarly, except Python can take in an additional parameter for a descending order, while that is not the case for JavaScript (C’mon JavaScript!!)</p><pre># Python<br>my_numbers = [4, 7, 9, 100, 43, 76, 98, 1, 23, 30]<br>my_favorites = [&quot;shiba inu&quot;, &quot;coding&quot;, &quot;rapunzel&quot;, &quot;baking&quot;]</pre><pre># Ascending<br># sort()<br>my_numbers.sort()<br>print(my_numbers)<br># [1, 4, 7, 9, 23, 30, 43, 76, 98, 100]</pre><pre>my_favorites.sort()<br>print(my_favorites)<br># [&#39;baking&#39;, &#39;coding&#39;, &#39;rapunzel&#39;, &#39;shiba inu&#39;]</pre><pre># sorted()<br>sorted_numbers = sorted(my_numbers)<br>print(sorted_numbers)<br># [1, 4, 7, 9, 23, 30, 43, 76, 98, 100]</pre><pre>sorted_favorites = sorted(my_favorites)<br>print(sorted_favorites)<br># [&#39;baking&#39;, &#39;coding&#39;, &#39;rapunzel&#39;, &#39;shiba inu&#39;]</pre><pre># Descending<br># sort()<br>my_numbers.sort(reverse=True)<br>print(my_numbers)<br># [100, 98, 76, 43, 30, 23, 9, 7, 4, 1]</pre><pre>my_favorites.sort(reverse=True)<br>print(my_favorites)<br># [&#39;shiba inu&#39;, &#39;rapunzel&#39;, &#39;coding&#39;, &#39;baking&#39;]</pre><pre># sorted()<br>reverse_sorted_numbers = sorted(my_numbers, reverse=True)<br>print(reverse_sorted_numbers)<br># [100, 98, 76, 43, 30, 23, 9, 7, 4, 1]</pre><pre>reverse_sorted_favorites = sorted(my_favorites, reverse=True)<br>print(reverse_sorted_favorites)<br># [&#39;shiba inu&#39;, &#39;rapunzel&#39;, &#39;coding&#39;, &#39;baking&#39;]</pre><p>What I love about the sorting method in Python is that it does exactly what you’re expecting: ascending/descending numbers, because that’s not the case in JavaScript.</p><p>In JavaScript,<strong> the default sort order based upon their UTF-16 code units values (Reference: </strong><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort"><strong>MDN</strong></a><strong>).</strong> Not that I have solid understanding what UTF-16 code units actually means, besides knowing it can take more bytes per character than UTF-8 and each character is assigned to a specific value.</p><p>Therefore, for JavaScript, you have to take an extra step by adding first and second parameter as comparison if you’re sorting numbers.</p><pre>// JavaScript<br>const numArr = [4, 7, 9, 100, 43, 76, 98, 1, 23, 30];<br>const strArr = [&quot;shiba inu&quot;, &quot;coding&quot;, &quot;rapunzel&quot;, &quot;baking&quot;];</pre><pre>// Ascending order<br>numArr.sort((a, b) =&gt; a - b);<br>console.log(numArr);<br>// [</pre><pre>// 1,  4,  7,  9,  23,</pre><pre>// 30, 43, 76, 98, 100</pre><pre>// ]</pre><pre>strArr.sort();<br>console.log(strArr);<br>// [ &#39;baking&#39;, &#39;coding&#39;, &#39;rapunzel&#39;, &#39;shiba inu&#39; ]</pre><pre>// Descending order<br>numArr.sort((a, b) =&gt; b - a);<br>// [</pre><pre>// 100, 98, 76, 43, 30,</pre><pre>// 23,  9,  7,  4,  1</pre><pre>// ]</pre><pre>strArr.sort().reverse();<br>console.log(strArr);<br>// [ &#39;shiba inu&#39;, &#39;rapunzel&#39;, &#39;coding&#39;, &#39;baking&#39; ]</pre><p>I had to Google how to sort strings in descending orders in JavaScript. Here’s the <a href="https://stackoverflow.com/questions/52030110/sorting-strings-in-descending-order-in-javascript-most-efficiently">Stack Overflow post</a> I used as reference.</p><p>(<a href="#b408">Back to “You Made It!” section</a>)</p><h4>You made it!</h4><p>Yay, you made it! Here’s quick summary of the 10 methods we covered [feel free to click on any of ’em to visit the method again]:</p><ol><li><a href="#dd31">Adding items to list/array:</a><a href="#dd31">append() vs </a><a href="#dd31">push()</a></li><li><a href="#3755">Removing specific items: </a><a href="#3755">remove() vs </a><a href="#3755">pop()/shift()/splice()/map()…</a></li><li><a href="#6366">Removing items II: </a><a href="#6366">pop() vs </a><a href="#6366">pop()</a></li><li><a href="#1110">Finding the length of a list/array: </a><a href="#1110">len() vs </a><a href="#1110">length()</a></li><li><a href="#a899">Counting the occurrences of a specific item: </a><a href="#a899">count() vs ???</a></li><li><a href="#32bb">Negative Indexes: </a><a href="#32bb">&lt;array&gt;[-1]</a></li><li><a href="#9f82">Adding elements to a certain index: </a><a href="#9f82">insert() vs </a><a href="#9f82">splice()</a></li><li><a href="#9559">Slicing an array: </a><a href="#9559">&lt;array&gt;[start:stop] vs </a><a href="#9559">splice()/slice()</a></li><li><a href="#b7db">Printing an array with a sequence of numbers: </a><a href="#b7db">range() vs </a><a href="#b7db">fill()/</a><a href="#b7db">map()/</a><a href="#b7db">for loops</a></li><li><a href="#2d07">Sorting: </a><a href="#2d07">sort()/</a><a href="#2d07">sorted() vs </a><a href="#2d07">sort()</a></li></ol><p>Before we say our goodbye, there’s one more method that I found very unique in Python but not in JavaScript.</p><h4>BONUS 🎉 — zip() 🤯</h4><p>zip() is useful when you want to aggregate elements from two or more iterable objects. It helps quickly solve problems, for instance, creating dictionaries. zip(*iterables) takes in two or more iterable objects and return a tuple.</p><pre>engineer_names = [&quot;Marie&quot;, &quot;Eddie&quot;, &quot;Al&quot;, &quot;Jean Paul&quot;]<br>engineer_ages = [20, 25, 21, 27]</pre><pre>result = zip(engineer_names, engineer_ages)</pre><p>If you print result, you would see something like this &lt;zip object at 0x7fed12377940&gt; -&gt; location of memory. If you recall we have briefly discussed the built-in list in Python at <a href="#b7db">#9</a>, don’t forget to add that if you want to see the list result.</p><pre>print(list(result))<br># [(&#39;Marie&#39;, 20), (&#39;Eddie&#39;, 25), (&#39;Al&#39;, 21), (&#39;Jean Paul&#39;, 27)]</pre><p>This built-in method quickly becomes one of my favorite Python built-in methods. It’s so cool!</p><p>More resources about zip() :</p><ul><li><a href="https://realpython.com/python-zip-function/#:~:text=Python&#39;s%20zip()%20function%20creates,programming%20problems%2C%20like%20creating%20dictionaries.">Using the Python zip() Function for Parallel Iteration</a> [Real Python]</li><li><a href="https://www.programiz.com/python-programming/methods/built-in/zip">Programiz</a></li><li><a href="https://www.geeksforgeeks.org/zip-in-python/">GeeksForGeeks</a></li></ul><p>As I was researching whether there’s a similar feature in JavaScript, I came across this <a href="https://stackoverflow.com/questions/4856717/javascript-equivalent-of-pythons-zip-function">Stack Overflow post</a> from 11 years ago. I found this comment pretty funny that I want to share to wrap up this article:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*2Ze2AFIjjCNoRp0pTMidtQ.png" /></figure><h4>Final Thoughts</h4><p>In comparison, Python has a lot more built-in methods and it’s quite a lot to remember. Regardless, I had so much fun learning Python and hope I can put this language in use and potentially work with both languages simultaneously to understand better the pros and cons of JS and Python.</p><p>And thanks CodeCademy for providing <a href="https://www.codecademy.com/learn/learn-python-3">Python3 hands-on coding course</a>. I learned all these methods from the course and wrote this article from my JavaScript experience perspective. Highly recommend to check that out!</p><p>And hey, FINALLY this is the end. My fellow JavaScript developers, how are we feeling about Python?</p><p>Please feel free to bookmark this article for your future reference if needed!</p><p>Last but not least,</p><p>Happy Coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*934y31nKCSUT0xS2.gif" /></figure><p>Completely sidenote: I love The IT Crowd! 👆🏻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7064a5df6e07" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Commands That I Love]]></title>
            <link>https://meganslo.medium.com/git-commands-that-i-love-b6dc46e4180d?source=rss-963906d24739------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6dc46e4180d</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Megan Lo]]></dc:creator>
            <pubDate>Fri, 25 Feb 2022 02:04:59 GMT</pubDate>
            <atom:updated>2022-02-25T02:09:45.434Z</atom:updated>
            <content:encoded><![CDATA[<h4>Git commands that I use often at work. Helpful for people who are working in teams and want to avoid merge conflict.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*eW-tDhgGYYcYleP6ni1JAg.png" /></figure><p>Disclaimer: This guide is targeted to new engineers who don’t have much experience working in teams. In the meantime, I’d like to welcome experienced engineers to chime in this conversation, as I continue to accumulate more experience through my journey.</p><h4>Intro</h4><p>Do you learn better with hands-on experience? Or do you learn better by reading? Or are you both? Let me be honest with you all, I learn better with hands-on experience. I have read dozens and dozens of Git-related articles, but I couldn’t grasp the concept well until I actually had to use these commands MYSELF. So I suggest you to open up your terminal or your VS code and get ready to these commands TO WORK! I would also attach a small guide on how to use these commands, so it’s easier for you to grasp the concept after reading each section. Alright, let’s cut to the chase!</p><h4>Git Commands I Love</h4><ol><li><strong>git commit -am &quot;message here&quot;</strong></li></ol><p>Are you familiar with git add . and git commit -m &quot;message here&quot; these two separate commands? I am here to tell you there is a shortcut to do this, which is git commit -am &quot;message here&quot; . This is only applicable to existing files. But before doing that, a good rule of thumb is to run git status first, which we will be discussing in the next point.</p><p><strong>How you can practice NOW</strong>:</p><p>Make changes in one of your existing files and type the command in your terminal. Don’t forget to push the file so you can see the changes on whichever Git-based source code repo hosting service you are using (ex: GitHub, GitLab, CodeCommit).</p><p><strong>2. </strong><strong>git status (before </strong><strong>git add )</strong></p><p>git status is very useful before you decide to commit anything, since there are a few scenarios you may encounter:</p><ul><li>You simply want to know which files you have made changes on.</li><li>You don’t want to commit all the changes you’ve made, especially working in teams. You may want to save some for only local use, and/or to avoid merge conflict later in projects, or;</li><li>There are newly created files that requires tracking remotely you might not be aware of.</li></ul><p>Also, it’s very useful to use this command to copy and paste the file name when you are using git add in the next step.</p><p><strong>How you can practice NOW:</strong></p><ul><li>Create a new file and try the command and see what it displays.</li><li>Make some changes in one of your existing files and compare the difference.</li></ul><p><strong>3. Follow these steps: </strong><strong>git status 👉 </strong><strong>git add 👉 </strong><strong>git commit 👉 </strong><strong>git pull 👉 </strong><strong>git push</strong></p><p>I understand each engineer has their own way of working things around, but I personally use these steps before pushing anything to a team repo. Let me explain why real quick.</p><p>I start with git status with the reasons I have mentioned above. Then I either do git add + git commit or git commit -am , depends on the situation (and sometimes mood — when I am feeling a bit ✨extra✨). And the reason I git pull first is because in the past for multiple times, I have gotten errors that someone in the team have made changes in the repo. Now I remember I need to git pull . Last but not least, git push the changes to the repo.</p><p>A little bit cliché to say so, but following these steps will help you avoid merge conflicts.</p><p><strong>How you can practice NOW:</strong></p><p>This might be more effective if you are working on a repo that has more than 2 people working on. But if you are on a 1-person project, try to make some changes (say the README.md) online, then push the changes. Then go back to your text editor, follow the steps and you should be able to see the changes when you do git pull .</p><p><strong>4. </strong><strong>git log (and </strong><strong>git reset)</strong></p><p>This command is very useful when you want to check all the recent commits (safe to say at least 10?) and/or if you want to rest the HEAD to one of the recent commits by using git reset --soft [&lt;commit&gt;] , which you can copy the commit reference number from git log .</p><p>Disclaimer: git reset --soft is only one of the git reset flags. There are a lot of combination for git reset , so it depends on your circumstances which flags will be more suitable.</p><p>I found git log useful especially when I am curious what changes have been made in the past and by whom.</p><p><strong>How you can practice NOW:</strong></p><p>This is quite straight forward that you can try it on the terminal to see all the commits you (and your teammates) have made in the past.</p><p><strong>5. </strong><strong>git commit --amend</strong></p><p>git commit --amend is quite straight forward. It will display the most recent commit messages. (And to exit, type :qa if you’re using Vim in the terminal.)</p><p>This is one of my favorite Git commands. A lot of engineers I have met have great sense of humor with the most hilarious commit messages (One of the examples I found on <a href="https://www.reddit.com/r/ProgrammerHumor/comments/375fjr/whats_the_most_humorous_commit_message_youve_ever/">Reddit</a>). However, in professional settings, a commit message implies what changes have been made so that other engineers can quickly pick up and work on the projects. Or even for your own references too. Your future you will thank your present you. Therefore, you may need to change some commit messages you’ve written in the past, and that’s how git commit --amend is so handy.</p><p><strong>How you can practice NOW:</strong></p><p>Type this command in your terminal. Change the commit messages. Then check your repo online to see if you can see the changes.</p><p>.</p><p>.</p><p>.</p><p>Super cool, right? 😃</p><p><strong>6. </strong><strong>git stash</strong></p><p>This is my personal favorite, because this reminds me of array (and there are a lot of reasons I love array). git stash stashes the changes you’ve made locally before you commit anything. A good rule of thumb when working in a project, especially if it’s big and have multiple people working on, is to do a git pull before you do any development. Sometimes you have made some changes locally, for instance, there are some configuration you’ve added that works on your machine, but it may break other people’s code, in this case, you’d git stash so you can git pull your teammates’ code to avoid any conflict. After you get the most updated version, you can pop the local changes back to your code (i.e. git stash pop).</p><p>Long story short, Git is usually presented in tree form. I am not the best person to explain how tree/tries works in data structure. pop and push exists in tries, so it might be easier to understand if you understand this type of data structure. But I always imagine that there’s an imaginary array, or stack, somewhere in the cloud and by doing git stash , I am stashing the local changes on top temporarily and I’ll pop the local changes back when I command it. I don’t know if this makes sense (it may if you are a visualizer).</p><p><strong>How you can practice NOW:</strong></p><p>If you are in a 1-person project, make changes in your repo online (not your text editor) and push the changes. Now go back to your text editor then try git stash , then do git pull which you’ll see the changes you’ve made online. Last but not least git stash pop to see changes you made both locally and online should show up simultaneously with no conflict.</p><p>If you are in project with teammate(s), ask them to make and push the changes. Then try on your local machine with the steps above.</p><h4>Special Mentions</h4><p>I originally posted the shorter version of this on my <a href="https://www.linkedin.com/posts/megan-s-lo_git-stuff-i-learned-in-the-past-3-months-activity-6887191947220537344-8HPB">LinkedIn</a>.</p><p><a href="https://www.linkedin.com/posts/megan-s-lo_git-stuff-i-learned-in-the-past-3-months-activity-6887191947220537344-8HPB">Megan Lo 🏊🏻‍♀️ 👩🏻‍💻 🇭🇰 on LinkedIn: Git stuff I learned in the past 3 months and saved me from a lot of | 109 comments</a></p><p>Got feedbacks from various experienced professionals to try out these commands that I didn’t mention above:</p><ol><li>git rebase vs git pull --rebase</li><li>git add -p</li><li>brew install tig</li><li>git ignore</li><li>git diff</li><li>git rebase — onto</li><li>git gui</li></ol><p>Once I am more familiar with the commands above, I will write a Part 2 of this article (…maybe)😃</p><p><strong>Most Recommended Resource by my LinkedIn fam</strong></p><p><a href="https://ohshitgit.com/">Oh Shit, Git!?!</a></p><h4>Epilogue</h4><p>Hope you enjoy this article! A few Git commands might be already a lot to take in, but practice whenever you remember or when you have a chance. I have hit the wall multiple times and had a lot of errors yelling at me until I remembered. Git can be annoying to some people, but honestly, please have some patience with it and read the errors. You will get a hang of it eventually!</p><p>Happy coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*Jzp7pSDzzJI5sTvGzucoQQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6dc46e4180d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[For New Developers: How to Stay Motivated And Positive When Job Searching (Ft. My Journey)]]></title>
            <link>https://meganslo.medium.com/for-new-developers-how-to-stay-motivated-and-positivewhen-job-searching-ft-my-journey-5acba907db60?source=rss-963906d24739------2</link>
            <guid isPermaLink="false">https://medium.com/p/5acba907db60</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[job-search]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Megan Lo]]></dc:creator>
            <pubDate>Tue, 07 Sep 2021 16:03:54 GMT</pubDate>
            <atom:updated>2021-09-07T18:13:48.663Z</atom:updated>
            <content:encoded><![CDATA[<h4>Spoiler Alert: It’s hard</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*-dXLjB6xnD_Az_W2UBYN3Q.png" /></figure><p>🌟Disclaimer: The advice may not apply to everyone, but I really hope that at least some of the following stuff would be helpful to your journey! Strong language may be involved.🌟</p><p>I want to navigate this article via my journey. I don’t want to just give straight up advice and tell you what to do this and that. I found it easier to have examples to demonstrate and specifically on how I turned my struggles into something positive.</p><h3>Background</h3><p>I finally accepted my first SWE job offer last week at my 7th-month of job searching (Sep 1, 2021). It was probably the hardest 7 months I have been in my life. I had to go through so many obstacles and insecurities to finally be able to gain the confidence and the positivity I have right now.</p><p>A little context about myself is that I graduated from college as a sociology major as class of 2020 and went to Flatiron School right after my graduation. There are not a lot of developers out there who came from a social science background (probably only like ~5% ), on top of that who recently graduated from college, on top of that as an Asian immigrant woman. I got somewhat discouraged at the beginning of journey when I realized I couldn’t find anyone who’s from similar background that I can look up to or ask advice from. I even thought it would be impossible for me to get a developer job.</p><p>Here’s how my emotional timeline looks like by month:</p><p>Month 1: Okay, I got this!</p><p>Month 2: okay i got more info from coffee chats now. i think i got this. i should be okay…right?</p><p>Month 3: why am i not getting interviews already? why are my friends getting interviews? was it because i don’t have previous professional work experience? was it because of my major?</p><p>Month 4: fuck, why am i still not getting interviews? am i really that incompetent? is it because of my resume? is it because of my shitty projects?</p><p>Month 5: (after getting rejected from a company which I had my first ever tech interview) 😭😭😭😭😭 i am so fucking dumb. why? why? why? i could’ve gotten the job offer, why did i not study async/await??? why? 😭 (and then, went on starting to ask more people for advice)</p><p>Month 6: (started to get interviews via referrals) okay, i know i fucked up my interviews but it’s okay i am loving the interview process and i think i’m getting a hang of it. I am really happy for my friends who just accepted their first SWE offers, YOU GO PEOPLE! AND YOU GOT THIS, MEGAN!</p><p>Month 7: (my Linkedin network started to get massive and I have already gotten involved into at least 2–3 “big” projects) Okay, wooohoo, you nailing this Megan 🎉 👉🏻 Proceed to get a job offer</p><p>I only started to gain confidence and become more positive probably in my last 2 months of my job search. I cannot count how many times I have cried late at night. I cannot count how many times I almost felt like wanting to slap the companies’ “faces” when I received automated rejection emails. I cannot count how many times I got jealous when I saw someone on LinkedIn got a job offer, especially those who got one after only 2–3 months of searching. But now looking back, I realized when people say, “everything happens for a reason,” I actually see it now. And that’s my key to how to stay positive during your job search.</p><h3>How I Stayed Motivated in my Job Search</h3><p>Here are a few ways I stayed motivated:</p><h4><strong>1. Always remind yourself why you are looking for a job as a developer</strong></h4><p>Although I had so much negativity especially in the beginning and the mid of my journey, one thing I never forget is <strong>my passion in programming</strong>. Yes, developers in entry level do earn way higher than average, this may be a motivation, but sometimes the compensation is not the most fulfilling. I’ve heard so many stories how many people would leave a 6-figure salary financial analyst job to become a chef or whatnot. Because it is all about passion. Same as you if you are transitioning your career or starting your first full time job like me! Never forget about your passion in programming, that’s how you stay resilient and motivated.</p><h4><strong>2. Take time to self-reflect and use your strengths to build confidence</strong></h4><p>I don’t usually code in the weekends or after 10pm every night, because… I don’t want to. Don’t get me wrong, it’s not because I hate it, but it’s because I like to take the down time to reflect on myself.</p><p><strong>In the beginning of my journey, I learned about my strength in content creating, especially on creating a more engaging post on Linkedin. </strong>As I grew up in the social media-era (or generation??), I learned what kind of content would attract more attention and how I can make some boring content into something more interesting (That is pretty much my style in writing tech articles). I am not into “clickbait” or anything and I promise everything I have posted on Linkedin came from the bottom of my heart. My key is that <strong>in order to make your post to reach more people, yes, keywords may be important, but you also need to learn how to write better post with a better story in it.</strong> I also tried to stay away from writing cliche contents, so I would always be creative on how I would write a post. To me, it is actually really fun and easy to do so. I also had the tendency to post things when I was at the lowest point of the week. This may sound silly, but <strong>I used the time by writing a post to internalize my negativity into something I consider “writing an advice to myself” and share that on Linkedin</strong>.</p><p>If your strength is being organized , use your strength by organizing your code and repos, etc. and demonstrate it to your interviewers and other SWEs. You can also use that strength as one of the Linkedin post contents or tech articles by showing how you use your creative way to organize certain things and your workflow with Trello board and such.</p><h4><strong>2b. Take time to self-reflect at times and use your other non-coding skills as a narrative</strong></h4><p>I made this bullet point as 2b, because it is still related to using your strength. I was very discouraged when I learned that not a lot of developers come from a social science background. But in the end, I found that that was my leverage and what made me unique as a candidate and developer. <strong>I learned how to use my sociology background to create a narrative and link it to my passion in web development/coding.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YN-sbu5mzpSKEnL80-hH6w.png" /><figcaption>From my <a href="http://megan-lo.dev/">portfolio</a> (I recently changed the picture and I forgot to fix the margin issue…)!</figcaption></figure><p>It definitely takes a lot of self-reflection, a lot from coffee chats when people asked me “why web dev?”, and feedback from behavioral interviews to create a more put-together story. <strong>I highly recommend spending some time thinking about the narrative, because that would be your answer to “Tell Me More About Yourself” question.</strong></p><h4><strong>3. Online presence — Put yourself out there and find your people!</strong></h4><p>As I have mentioned from my previous bullet point, I found my strength in creating a more engaging Linkedin content. It might not be an easy task for some people, but for me, that’s like my way of building my network and showing my personality.</p><p>You may think this is so hard or whatnot. But<strong> think about this way, it is not only about your online presence or what kind of content you are writing. It is a way for people to reach out to you.</strong> It took me some time to build my network for sure, and towards the end of my job search journey, I started to meet even more people and people were offering referrals (the tech community is extremely supportive!! I couldn’t be more grateful!). I have also found a group of people who eventually become my close friends and we shared tips and resources with each other.</p><p>If you are an introvert, I am too an introvert who likes talking to people, but I am not someone who is good at initiating a conversation. So instead, I use my strength by creating more contents and engaging with the audience in return to have people reach out to me. And yes, I genuinely enjoy every conversation I have with every single person I connected with.</p><p>🌟<strong>Quick note</strong>: Don’t spend too much time on Linkedin though. Learn how to allocate your time. I once spent too much time on Linkedin and I couldn’t stand the over-positivity on the platform *seriously, im not kidding. this is real*. I sometimes would take a week break from LI here and there and took the time to focus on other things that I can work on.🌟</p><h4><strong>4. Don’t grind Leetcode thinking that is for interviews</strong></h4><p>It is quite unfortunate that it seems like grinding LC to prep for interviews has become an obligation and a norm.</p><p>I still remembered a friend of mine who got into Amazon recently told me that he found the fun in grinding LC. I was literally shocked. But after my first whiteboarding interview (which I almost bailed on), I suddenly had an epiphany that my friend… was right LOL. Ever since then, I usually went into tech interviews in a pretty lax mood (literally wore one of my dozens of T-shirts to go to interviews). I ended up enjoying most of my tech interviews. Most of the time, it’s because I have met interviewers who were willing to offer help even if I was struggling. Of course, in the end, I got rejected, but I have learned from those experiences and got better at problem solving and solving algo questions. <strong>Going to actual tech interviews is actually the best way to grow and learn, even you got rejections in the end.</strong> Pramp and so many mock interview platforms is cool to gain interview experiences, but it never beats the experience of an actual interview.</p><p>When you work on these LC questions, <strong>think about how it would help improve your problem solving skills, instead of thinking this is for tech interviews.</strong> By the way, till this day, I can only do easy level, maybe medium-ish level string and array/hashmap questions, so please don’t think that you need to be really good at DSA, especially I understand you are in an extremely stressful situation and having the ability to learn something so complex in a short period of time just for the sake of getting an entry level job is kinda… tough unless you are aiming for FAANG🙌🏻 I ain’t gonna stop you 😆</p><h4>5. GO FOR A WALK!</h4><p>I found walking to be a really helpful activity for breaks! I always took a walk at around 3 or 4pm because that’s when I started losing concentration (and I will continue to do that). <strong>Going out for a walk is not for the purpose of thinking about the challenges you were stuck in, but it’s more for taking your mind off from intense work.</strong> I always listened to my favorite music, depending on my mood and I always came home feeling lighter and happier.</p><p>I highly recommend going out for a walk when you start noticing yourself not being able to focus. Maybe download a walking app, set yourself a program within the app and celebrate the achievement afterwards.</p><p>There are other ways, of course, like going out for a swim, going to gyms, etc. I<strong> would definitely recommend to at least GET OUT OF YOUR HOUSE sometime in the day so you can get some fresh air and come back with a FRESHER MIND</strong>😎 (breath out all the indoor air and breath in all the outdoor air — aaahhhh namaste 🙏🏻).</p><h4>6. Maintain good rapports with your recruiters (and hiring managers)</h4><p>This may sound silly for motivation wise. But it’s true. I found my motivation via maintaining good rapports with the recruiters and hiring managers. <strong>I may have been rejected from these companies, but I had great conversations with the people I have talked to within the companies I was interested in.</strong> By communicating openly, you, as a candidate, will make their jobs easier, so as your job searching experience. I always showed a lot of gratitude to the recruiters that I worked closely because I sincerely appreciate the work they have done and it’s not easy to be the middle person. Their ways of responding your questions also show the companies culture, which helps you make decision whether you believe you will fit in the company’s culture or not. <strong>Interviews are not a one-way street, it’s always two-ways.</strong> They interview you, so are you. You may heard of the term, “flip the table”. ’Cause in the end when they end up giving you an offer, the ball is your court and you are the one who make the decision whether you would take the offer or not.</p><p>Once you understand how to communicate better with the recruiters and hiring managers, even though you may be rejected from the companies for 10,000 other reasons, in the end, you leave a good impression to these people, and it is a way to continue to motivate yourself to be a better candidate each time.</p><h4><strong>7. Sometimes… it’s really about luck and timing</strong></h4><p>I’ve got a few friends who were able to get a job offer just a few weeks or even less after graduating from their bootcamp. But I know these people had been looking for jobs even before they graduated from bootcamps, like my friend, <a href="https://medium.com/u/b606c22a151e">Eva</a> who had been joining events actively, posting her experience on Linkedin and eventually caught the attention from a recruiter at her current company (please check out her amazing articles!). Honestly, if you believe you have done everything you can (I am talking about portfolio, online presence, network, etc., I will post another article regarding that in the near future), <strong>sometimes you just gotta find that right person/company</strong>.</p><p>I got connected to the recruiter at my current company via my bootcamp’s career service’s connection in less than 2 business days after I applied. I was extremely grateful with the interview process. They literally had my portfolio opened during the interviews and asked me about the stuff I wrote. The interview went very smoothly and very personal since they were able to ask quite specific questions based on my portfolio and they made the interviews so much easier for me to give them more specific answers. (Like, “I noticed that you have written several blogs on your portfolio and a few of the blog topics seem quite interesting. What was your motivation and how did you get into writing these blogs?”)</p><p>In the tech interview round, I was asked to solve an algo question. After I suggested a possible working solution, my two interviewers stepped in, asked a few questions about my solution and started our whole “pair programming” process. It did not feel like an interview, but rather it felt like I was just talking to two more experienced developers at work. I was very thankful to have such smooth interview process and it made me felt at ease. I just knew this is the company I want to work for and I am so happy they are willing to say “yes” to me too.</p><p><strong>You may have different interview experiences but you will eventually find a company who will say “yes” to you. It takes some time and luck, but trust me, there will be one, or even two or more when the timing’s right</strong>.</p><h3>My Takeaways After Searching for 7 Months and How I Turned My Negativity into Something Positive</h3><p>I was extremely negative at the beginning and the mid of my journey (pretty sure I’ve mentioned that at least 3 times in this article), but because I kept on grinding and tried to fight the negativity demons in me, at one point of my journey, I started to look back all the things I have achieved and done, and I was like… wow. It’s like spending so much time climbing that mountain and when you climb to the top of the mountain, you see this beautiful view. All the hard work suddenly becomes… gratitude.</p><p>If you have grinded for ~6 months like I did, you would be amazed on how much you have achieved and how much you have grown as a developer. Everything do happen for a reason. Maybe your journey is meant to be tough and luck don’t come easily to you in the first few months. It is a sign that you just gotta keep looking and keep building your skills.</p><p>I was amazed on the projects I have done. I was amazed on the team experience I have gained. I was amazed about the people I have met and friends I have made along this journey. As someone who have job searched for 7 months, I could not imagine what I would be like if I have gotten a job in the span of a few weeks after I graduated from bootcamp (by the way, I am not saying people who do get a job after a few weeks of graduating is a bad thing. Everyone’s experience is different.) My network has grown so much to the point that I feel comfortable enough on who to reach out to and who I can ask for advice from and even ask for referrals from my friends who recently got job offers.</p><p><strong>Throughout your time looking for jobs, you will face a lot of rejections</strong> (more than half of them will definitely be automated emails — “after a serious consideration….”). You may hear a lot of people telling you “rejection is a redirection”, something like that. That can be true, of course, but sometimes a rejection is not because of your resume is bad, you are not qualified, or you don’t have the skills. So it’s not exactly about the “redirection”. <strong>It’s really about your mindset and how you perceive different things.</strong></p><p>I always give myself a pat in the back whenever I got a callback for a phone interview, or even moving on to the next stage. I always try to keep myself calm and not get too excited for a company, because I know I might end up disappointing myself if I failed to move forward. When you are working on a volunteer project, think about how it would benefit you later in a professional environment and how it makes you a more adaptable person/developer because you have gained communication and team experience. There are so, so, so many ways of <strong>changing that “i am doing this for my resume” mindset into “this is for the long run and for the rest of my career” mindset</strong>. You just gotta learn to see everything in a more positive light.</p><p><strong>This is my take on how to stay positive on job searching and I really hope my personal experience throughout my job search will help you with YOUR job search experience.</strong> If you found this article helpful and would like to get a more personalized advice, please feel free to shoot me a message via <a href="http://www.linkedin.com/in/megan-s-lo/">Linkedin</a> (and feel free to skip the small talk and tell me your background and how I can help you). I am more than happy to share my POV and answer any questions you have!</p><h3>Future Readings</h3><p>I would also like to share a few useful articles, including <a href="https://medium.com/u/b606c22a151e">Eva Yi Zheng</a>’s:</p><p><a href="https://yi-zheng1709.medium.com/how-i-landed-my-offer-tips-for-bootcamp-students-675a6d8096e9">How I Landed My Offer — Tips for Bootcamp Students</a></p><p>and <a href="https://medium.com/u/946190286a25">Waverley Leung</a>’s</p><p><a href="https://levelup.gitconnected.com/reflections-from-a-bootcamp-grad-on-whats-next-9c110a522f5f">Reflections from a Bootcamp Grad on “What’s Next?”</a></p><p>Both of them are amazing developers and have recently accepted their first SWE job offers as bootcamp grads.</p><p>As well as <a href="https://medium.com/u/2833903fc73d">Alex Chiou</a>’s</p><p><a href="https://chioualexander.medium.com/how-to-effectively-apply-to-jobs-as-a-junior-engineer-37a90312d4fd">How To Effectively Apply To Jobs As A Junior Engineer</a></p><p>Which I have used as a guide to help improve my applications and</p><p>last but not least, <a href="https://medium.com/u/c75ea57b8ce">Alison Quaglia</a>’s</p><p><a href="https://levelup.gitconnected.com/into-the-unknown-advice-for-breaking-into-the-tech-industry-9ba3ce52645">Into the Unknown: Advice for Breaking into the Tech Industry</a></p><p>Which I have used to guide me through the beginning of my journey.</p><h3>Last but not least…</h3><p>Happy Coding!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/0*oK73GxXtUDEURVED" /><figcaption>Credit: <a href="https://fossbytes.com/wp-content/uploads/2016/02/programming-happy-fast-gif.gif">here</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5acba907db60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[for…in vs for…of in JavaScript]]></title>
            <link>https://medium.com/geekculture/for-in-vs-for-of-in-javascript-8563bd3e0672?source=rss-963906d24739------2</link>
            <guid isPermaLink="false">https://medium.com/p/8563bd3e0672</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[iteration]]></category>
            <dc:creator><![CDATA[Megan Lo]]></dc:creator>
            <pubDate>Wed, 25 Aug 2021 06:45:29 GMT</pubDate>
            <atom:updated>2021-08-26T07:58:33.293Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*itoHjQ0e_3hpMKfldDAymA.png" /></figure><p>For quite a while, I have been struggling to fully understand the differences between for…in and for…of. If you found this via Google or the dev.to feed, I can safely assume that you are probably wondering the same thing. for…in and for…of are the alternative of the for loop that we are all familiar with. However, for…in and for…of are used in different occasions depends on what you are looking for while the for loop we know can be used in basically in any situation.</p><p>We will first go over the examples/usages, then we’ll break down each of them.</p><h4>Examples/Usages</h4><p><strong>👉🏻 </strong><strong>for</strong></p><pre>const arr = [1, 2, 3, 4, 5]</pre><pre>function printArr(arr) {<br> for (let i = 0; i &lt; arr.length; i++) {<br> console.log(arr[i]);<br> }<br>}</pre><pre>console.log(printArr(arr));<br>// 1<br>// 2<br>// 3<br>// 4<br>// 5</pre><p><strong>👉🏻 </strong><strong>for…in</strong></p><pre>const obj = { a: 1, b: 2, c: 3 }<br>function printObj(obj) {<br> for (let prop in obj) {<br> console.log(`prop: ${prop}`)<br> console.log(`obj[prop]: ${obj[prop]}`)<br> }<br>}</pre><pre>console.log(printObj(obj));</pre><pre>// prop: a<br>// obj[prop]: 1<br>// prop: b<br>// obj[prop]: 2<br>// prop: c<br>// obj[prop]: 3<br>```</pre><p><strong>👉🏻</strong> <strong>for…of</strong></p><pre>const arrOf = [1, 2, 3, 4, 5]<br>function printArrOf(arr) {<br> for (let ele of arr) {<br> console.log(ele);<br> }<br>}</pre><pre>console.log(printArrOf(arrOf));</pre><pre>// 1<br>// 2<br>// 3<br>// 4<br>// 5</pre><p>Now you saw how they are used, let’s break them down one by one!</p><h4>Our Dear Best Friend, The `for` Statement</h4><p>This basic for loop can be used anytime when we need iteration in anything.</p><p><strong>Basic Syntax</strong></p><pre>for ([initialization]; [condition]; [final-expression]) {<br> statement<br>}</pre><p>The iteration usually happens inside the block (a.k.a {}). We would put multiple statements inside the block for the loop to be executed. You may use break, continue, etc. to continue or break the for loop based on the conditions.</p><p><strong>Example with </strong><strong>break</strong></p><pre>for (let i = 0;; i++) {<br> console.log(i);<br> if (i &gt; 5) break;<br>}</pre><pre>// Expected Output: <br>// 0<br>// 1<br>// 2<br>// 3<br>// 4<br>// 5<br>// 6</pre><pre>// Explanation: The loop breaks when i is larger than 5.</pre><p>✨ Quick Note: All those expressions inside the parentheses are optional.</p><p><strong>Example with </strong><strong>continue</strong></p><pre>for (let i = 0; i &lt; 10; i++) {<br> if (i === 7) continue;<br> else console.log(i);<br>}</pre><pre>// Expected Output:<br>// 0<br>// 1<br>// 2<br>// 3<br>// 4<br>// 5<br>// 6<br>// 8<br>// 9</pre><pre>// Explanation: if i is equal to 7, we will skip that i and move on to the next index.</pre><h4>`for…in`, Protagonist #1</h4><p>for…in loop iterates over all <strong>enumerable properties</strong> of an object.</p><p>If you don’t know what enumerable is, I’ll do my best to explain what it is. Basically you can think of enumerable property is the key of the key-value pair in an object. It will also show up in the Object.keys() method. So if we look at our example from the section above…</p><pre>const obj = { a: 1, b: 2, c: 3 }</pre><pre>function printObj(obj) {<br> for (let prop in obj) {<br> console.log(`prop: ${prop}`)<br> console.log(`obj[prop]: ${obj[prop]}`)<br> }<br>}</pre><pre>console.log(printObj(obj));</pre><pre>// prop: a<br>// obj[prop]: 1<br>// prop: b<br>// obj[prop]: 2<br>// prop: c<br>// obj[prop]: 3</pre><p>prop is the key in the key-value pair and that’s our enumerable properties. If you have basic understand on how to retrieve the value of an object, we treat the key like index in an array and put it in a square bracket 👉🏻 obj[prop], like this.</p><pre>const obj = { <br> name: “Megan”, <br> age: “do the Math”, <br> role: “front-end developer” <br>}</pre><pre>for (const property in obj) {<br> console.log(property);<br>}</pre><pre>// Expected Output:<br>// name<br>// age<br>// role</pre><p>So far, our examples are all in object, or {} (as array is also an object), it is not recommended/ good practice to use for…in to iterate over an array, where the index order is important.</p><p>Yes, array indexes are also enumerable properties but in integer. It behaves quite unpredictably if we use for…in to iterate an array. It is not guarantee that the elements are iterated in a specific order. Also, if you want to extend the array by assigning to an index that is beyond the current size of the array, it may not reflect the correct index. Therefore, for…of, forEach, or for loop with a numeric index is a better method to iterate an array. Check out the examples demonstrated in this article below 👇🏻</p><p>Further Readings:</p><ul><li><a href="https://betterprogramming.pub/3-reasons-why-you-shouldnt-use-for-in-array-iterations-in-javascript-8db3f42d8c73">3 Reasons Why You Shouldn’t Use “for…in” Array Iterations in JavaScript</a> by Johannes Baum</li></ul><h4>`for…of`, Protagonist #2</h4><p>Now here’s our second protagonist, for…of. In case you don’t know, for…of is introduced in ES6. for…of has become a useful iteration method for a lot of JavaScript developers. for…of can iterate over any <strong>iterable objects</strong>. You name it, String, Array, Object…</p><p><strong>String</strong></p><pre>const name = “Megan”;</pre><pre>for (const alphabet of name) {<br> console.log(alphabet);<br>}</pre><pre>// Expected Output:<br>// M<br>// e<br>// g<br>// a<br>// n </pre><p><strong>Array</strong> (copied from the Example section)</p><pre>const arrOf = [1, 2, 3, 4, 5]</pre><pre>function printArrOf(arr) {<br> for (let ele of arr) {<br> console.log(ele);<br> }<br>}</pre><pre>// Expected Output:<br>// 1<br>// 2<br>// 3<br>// 4<br>// 5</pre><p><strong>Object</strong> (With the help of Object.entries())</p><pre>const obj = {<br> name: “Megan”, <br> age: “do the Math”, <br> role: “front-end developer” <br>};</pre><pre>for (const [key, value] of Object.entries(obj)) {<br> console.log(key, value);<br> console.log(`${key}: ${value}`);<br>}</pre><pre>// Expected Output:<br>// name Megan<br>// name: Megan<br>// age do the Math<br>// age: do the Math<br>// role front-end developer<br>// role: front-end developer</pre><pre>// Explanation: the [key, value] is a destructure of the result from Object.entries.</pre><p><strong>🐧 Sidebar Note 🐧</strong><br>Object.entries() returns an array of a given object’s own enumerable string-keyed property.</p><pre>const obj = {<br> name: “Megan”, <br> age: “do the Math”, <br> role: “front-end developer” <br>};</pre><pre>Object.entries(obj)<br>// [<br>// [ ‘name’, ‘Megan’ ],<br>// [ ‘age’, ‘do the Math’ ],<br>// [ ‘role’, ‘front-end developer’ ]<br>// ]</pre><p>Further Readings:</p><ul><li><a href="https://danielmjung.medium.com/demystifying-the-es6-for-of-loop-9c1a0166d1c6">Demystifying the ES6 ‘for-of’ Loop</a> by Daniel Jung</li><li><a href="https://dmitripavlutin.com/javascript-for-of/">Why for…of Loop in JavaScript is a Gem</a></li></ul><h4>When Should We Use Which One? 😯</h4><p>The purpose of this section is put these two for statements “side by side”, so we can have a comparison.</p><p>Here’s a simple way to remember this:<br>⭐️ Use for…in when iterating the object’s enumerable string-keyed property pairs. You know the { blah1: blah blah, blah2: blah blah blah }. BUT NOT ARRAY!! Remember think of whatever it is logged will be like logging the index of an array, but the string, so if you want to log/return the value, make sure print it with obj[key]. <br>⭐️ Use for…of when iterating over iterable objects: String, Array, etc.</p><p>Further Readings:</p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of#difference_between_for...of_and_for...in">Difference between for…of and for…in</a> by MDN</li></ul><p>Next time when you are working on something that needs iteration, or just doing your regular Leetcode practice, or even BETTER… in your tech interviews, show off your newly obtained knowledge with for…of and for…in.</p><p>Last but not least… Happy Coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*1KNRChNXSPMC4fJN" /></figure><p>Hello, my Medium readers! This article is originally posted on <a href="https://dev.to/mehmehmehlol/for-in-vs-for-of-in-javascript-174g">dev.to</a> (direct link to the article), since I am currently more active on that platform. I am posting the same content here as I would like to reach out to more audience. If you enjoy what you are reading, please follow me on <a href="https://dev.to/mehmehmehlol">dev.to</a> (my profile)!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8563bd3e0672" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/for-in-vs-for-of-in-javascript-8563bd3e0672">for…in vs for…of in JavaScript</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Tech Interviews Experience]]></title>
            <link>https://meganslo.medium.com/my-tech-interviews-experience-2765716f6629?source=rss-963906d24739------2</link>
            <guid isPermaLink="false">https://medium.com/p/2765716f6629</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tech-interview]]></category>
            <category><![CDATA[codingbootcamp]]></category>
            <dc:creator><![CDATA[Megan Lo]]></dc:creator>
            <pubDate>Mon, 02 Aug 2021 05:11:11 GMT</pubDate>
            <atom:updated>2021-08-03T00:15:29.480Z</atom:updated>
            <content:encoded><![CDATA[<h4>My takeaways in tech interviews as a coding bootcamp grad</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*FIit9v77FTci6BDp.gif" /></figure><p>Today, I hit my 6th month mark of my job searching journey. Yep, 6th month. A lot of my new friends that I have met over LinkedIn are getting job offers. Of course, I am really happy for them, yet it was really tough for me whenever a friend told me they got a job offer because that means… they will no longer be in this journey with me.</p><p>One of the most frustrating moments throughout this journey was that I was not getting a lot of interviews, until a couple months ago, I finally got my first tech interview, which I was in the final round… and yep, I got rejected, because of my lack of knowledge in React lifecycle methods in React Hooks (I knew how to use componentDidMount and it was a huge deal to use useEffect as it was my first time at that time to actually knew how to use that). Ever since that interview, I understood my strengths and weaknesses and was much more determined to be a way better candidate.</p><p>It took me another month or so to finally get two more tech interviews — in total, 3 tech interviews throughout this journey. I knew very well that I bombed both of them, but I was super grateful for these two interviews. And interestingly, the contents of the two interviews were very different. One of them was the traditional kind of whiteboard interview, which I was asked to solve a medium Leetcode question, and oh my god, I was freaking out before that interview, because I was aiming for front-end position and did not spend much time studying data structures. The other one was parsing a CSV data, i.e. turning an extremely long string into a nested, organized object.</p><p>I also have to point out that I did use mock interview platforms, like Pramp, a few months ago. I had a hard time breaking down the questions. I am still not very familiar with graph and dynamic programming as of today. At this moment, I have no intention learning the more difficult data structure concepts as I am not aiming for large tech companies.</p><p>Here’s my takeaways from those two interviews:</p><ol><li><strong>Print the inputs in a function if struggling</strong></li></ol><p>Always console.log the inputs, especially if I have a hard time seeing it. What I mean by that is that sometimes there is something hidden in that string you are provided, or in my case, even the interviewer hinted so many times there is a line break. It was not inside the string and I did not realize that \n is what she meant by line break. After I was struggling on how to split a string with this “line break thing”, my interviewer gave me a big hint to console.log the input by splitting the string into an array, and yep, now I see that \n hanging inside the array.</p><p><strong>2. Work on the working solution first before worrying about the optimization</strong></p><p>Throughout the two interviews, although I had a working solution in mind, my brain was always worried about whether the solution (or pseudocode) I had was not optimized enough. In the end of the interviews, I only had the psuedocode written, but not the actual code. In both times, my interviewers helped me break out of my confusing cloud by telling me to try to write my brute force solution first and run the code and this leads to my next takeaway.</p><p><strong>3. Run the code while writing the solution if unsure</strong></p><p>I have heard that sometimes in the interview, they don’t let you run the code in the middle of interview. However, I was allowed to run the code as many times as I needed to, and you know what, my inexperienced brain was not smart enough to understand how important that is. During the interviews, I had my pseudocode ready and I communicated with my interviewers what I would want my solution to look like and my head was in the confused mode wondering whether it would actually work. As I continued to communicate with my interviewers and get more and more confused with myself, both my interviewers told me, “Why don’t you go ahead and try the run the code?” And yep, I knew how my code looks now… it was quite close to the sample output, yet and got so much to work on… but it was already the end of the interview.</p><p><strong>4. Don’t just talk, write the code and get it work</strong></p><p>This takeaway is probably a summary for all the takeaways above. My biggest strength is that I am good at communicating. I heard that dozens of times from different people. Despite being good at communication is a good soft skill, interviewers/employers want to see how good you can code. I spent so much talking about my solutions that I didn’t even have enough time to have my full brute force solution written.</p><p>It could be some imposter syndrome going on, ’cause I remembered during the interviews I kept thinking, “I don’t think I can do this.” So, I usually use talking to help ease my nerves, but that doesn’t demonstrate my programming skills.</p><p><strong>5. Break down the problem piece by piece</strong></p><p>This is probably the most cliche takeaway. I am a big picture person, so I like to see the big picture before getting into the details. I realized it was a huge disadvantage for me, as I would spend a lot of time figuring out what this particular question actually do and why I need it. After a few interviews, I realized although having a big picture is important, more importantly, it’s how I would break down… let’s say an extremely long string. Questions like how would I split this string, or how would I push this to an array, or how could I make this element into a key of object, etc. These are more obvious examples/questions, but it really helps when you have an input and output in front of you and you have to figure this out piece by piece until you get a working solution.</p><p>It’s similar to how you solve an algebra question like 3x + 1 = 6x + 5. Like you won’t start immediately think what x is. Yes, that’s the end goal. But we have to think like how to get all the x’s on one side and all the numbers on the other. It’s similar to how we solve a data structure.</p><p>Now I am at my 6th month mark. I am really hoping to get more tech interviews. I am okay if I bomb the interviews, because in each interview, it teaches me different lessons and know what I have to improve on. Same goes to all of you readers who are reading this today. Don’t let one interview that you bomb devastated you, it’s a way to grow. If you bomb an interview today in your dream company, don’t let the rejection unmotivate you. I have seen dozens of people from LinkedIn feed getting into their dream companies after a couple years of work experience. The rejection is not the end of the world.</p><p>If you read till the end of this article, I appreciate you. I feel like this is more of a reflection journal, and if you find that my takeaways/mistakes are helpful, I hope that you would also understand and learn my mistakes and not make the same mistakes I made in your interviews. So, good luck!!</p><p>Last but not least, get your coffee/tea, dance to some happy music and happy coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/0*3ee5uXWz9gqTeeN9.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2765716f6629" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RESTful API 101]]></title>
            <link>https://medium.com/geekculture/restful-api-101-b61671e5a3ea?source=rss-963906d24739------2</link>
            <guid isPermaLink="false">https://medium.com/p/b61671e5a3ea</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Megan Lo]]></dc:creator>
            <pubDate>Mon, 05 Jul 2021 04:59:59 GMT</pubDate>
            <atom:updated>2023-03-02T16:40:29.379Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/938/0*VPXZr6owws7g7KY2.png" /><figcaption>Credit: <a href="https://www.seobility.net/en/wiki/REST_API">Seobility</a>’s REST API wiki page</figcaption></figure><p>When I first learned RESTful API, I pretty much followed every tutorial I can find on how to use RESTful API and then I implemented on my projects. Well, guess what? Before writing this article, I still couldn’t properly form in words when people asked me what RESTful API was. Therefore, I would like to write an article about RESTful API or REST for those who just started to learn about fetching APIs or need a refresher!</p><h3>Introduction</h3><p>Let’s say you are searching for “How to use RESTful API” on Google search field, and then hit enter. You will see a list of results, including YouTube videos and articles like what I had below. A REST API works in a similar way, except you get a list of results from the service you are requesting from.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*an6WyU_f1AomHTJkfzscpg.png" /></figure><p><strong>REST</strong> stands for <strong>RE</strong>presentational <strong>S</strong>tate <strong>T</strong>ransfer. REST is a software architectural style (or software design pattern) that was created to guide the design and development of the architecture of World Wide Web. REST was first represented by Roy Fielding in 2000 in his Phd dissertation. REST uses various representation to represent a resource, like JSON (for JavaScript developers especially), XML and text, which JSON is the most popular one.</p><p>API, which stands for application programming interface, is created by developer to allow the client to talk to the server.</p><p>REST determines how the API looks like. It is a set of rules that developer follows when creating the APIs. One of the rules is you should be able to get a piece of data (a.k.a. a <strong>resource</strong>) when you link to a specific URL.</p><p>For those who have used REST in their projects before, you might be familiar with the following four HTTP methods, which are commonly used in REST based architecture:</p><ul><li><strong>GET</strong> (Provide a read-only access to a resource)</li><li><strong>POST</strong> (Create a new resource)</li><li><strong>PUT</strong> (Update a existing resource)</li><li><strong>PATCH</strong> (Update a existing resource)</li><li><strong>DELETE</strong> (Remove a resource)</li></ul><p>Each URL is called a <strong>request</strong> and the data that got sent back to you is called a <strong>response</strong>.</p><h3>RESTful Web Services</h3><p>When you are looking for resources on how to use RESTful API, you might come across with the term “<strong>RESTful Web Services</strong>”. A web service is a collection of open protocols (not owned by any particular company and not limited to a particular company’s products — from <a href="https://www.khanacademy.org/computing/computers-and-internet/xcae6f4a7ff015e7d:the-internet/xcae6f4a7ff015e7d:developing-open-protocols/a/open-standards-and-protocols">Khan Academy</a>)and standards used for exchanging data between applications or systems.</p><p>A web service that is based on the REST Architecture is known as RESTful web services. You might be familiar with using HTTP methods to create a request for API. These web services uses the HTTP methods that are mentioned above to implement the REST architecture. A RESTful web services usually defines a URI (Uniform Resource Identifier), which provides resource representation such as JSON and a set of HTTP methods.</p><p>Let’s say we have the following JSON file which contains multiple users:</p><pre>{<br>  &quot;user1&quot;: { <br>     &quot;id&quot;: 1,<br>     &quot;username&quot;: &quot;nerdthegeek&quot;,<br>     &quot;password&quot;: &quot;nerd1234&quot;<br>  },<br>  &quot;user2&quot;: {<br>     &quot;id&quot;: 2,<br>     &quot;username&quot;: &quot;githublover&quot;,<br>     &quot;password&quot;: &quot;dontlovegit&quot;<br>  },<br>  &quot;user3&quot;: {<br>     &quot;id&quot;: 3,<br>     &quot;username&quot;: &quot;theonewhocodes&quot;,<br>     &quot;password&quot;: &quot;code2244&quot;<br>  }<br>}</pre><p>With the information above, we are going to provide the following RESTful APIs.</p><pre>+------------+-----------------+---------------------------------+<br>|   URI      |   HTTP Method   |            Result               |<br>+------------+-----------------+---------------------------------+<br>| listUsers  | GET             | Show list of all the users      |<br>| addUser    | POST            | Add details of new user         |<br>| deleteUser | DELETE          | Delete an existing user         |<br>| :id        | GET             | Shows of that user with that id |<br>+------------+-----------------+---------------------------------+</pre><p>It is important to first understand the anatomy of a request before copying any code example from any tutorial (I made that Rookie mistake 🥲).</p><h3>The Anatomy of a Request</h3><p>There are 4 things in the request:</p><ol><li>The endpoint</li><li>The (HTTP) method</li><li>The headers</li><li>The data/body</li></ol><h4>Endpoint</h4><p>The <strong>endpoint</strong> is the URL you request for. The root-endpoint is the starting point of the API you are requesting from. For instance, the root-endpoint of Github API is https://api.github.com . The <strong>path</strong> determines the resources you are requesting for. You may have seen :username something like that. Any colons (: ) on a path denotes a variable, so you have to replace these values with actual values of when you send a request. So let’s say you would like to access your own Github repo, in my case, it would be:</p><pre><a href="https://api.github.com/users/mehmehmehlol/repos">https://api.github.com/users/mehmehmehlol/repos</a></pre><p>(All example reference is based on this article: <a href="https://www.smashingmagazine.com/2018/01/understanding-using-rest-api/">Understanding And Using REST APIs</a>)</p><h4>Method</h4><p>As we mentioned about the HTTP request earlier (GET, POST, PUT, PATCH, DELETE), these methods provide meaning for the requests you are making. You may be familiar with <strong>CRUD</strong>, which is Create, Read, Update, Delete. The methods are used to perform these four possible actions.</p><p>Let’s break these methods down:</p><ul><li>GET : If you perform a GET request, the server looks for the data you requested and sends it back to you. A GET request performs the READ operation. It is also a default request method.</li><li>POST : If you perform a POST request, the server creates a new entry in the database and will tell you whether the creation is successful. A POST request performs the CREATE operation.</li><li>PUT &amp; PATCH : If you perform a PUT or PATCH request, the server updates an entry in the database and will tell you whether the update is successful. A PUT or PATCH request performs the UPDATE operation.</li><li>DELETE : If you perform a DELETE request, the server deletes an entry in the database and tells you whether the deletion is successful. A DELETE request performs a DELETE operation.</li></ul><p>(I will update this article with code examples)</p><h4>Headers</h4><p>Headers are used to provide information to both the client and the server. it provides additional information with the HTTP request or response. There are many types of headers. The full list is provided in MDN’s <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers">HTTP headers</a>. Examples like &#39;Content-Type&#39;: &#39;application/json&#39; . HTTP headers are always key-value pair. This example tells the server to expect JSON content.</p><h4>Data/Body</h4><p>The data contains information you want to be sent to the server. This option is only used with POST , PUT, PATCH or DELETE requests.</p><p>There you go! That’s pretty much all you need to know about RESTful APIs! Please let me know what you like to know more about RESTful APIs and what you would like me to add in this article so that it can be more informative and easier to follow, especially for beginners!</p><h3>Resources</h3><ul><li><a href="https://www.tutorialspoint.com/nodejs/nodejs_restful_api.htm">Node.js - RESTful API</a></li><li><a href="https://restfulapi.net/">What is REST?: REST API Tutorial</a></li><li><a href="https://en.wikipedia.org/wiki/Representational_state_transfer">Representational state transfer - Wikipedia</a></li><li><a href="https://www.smashingmagazine.com/2018/01/understanding-using-rest-api/">Understanding And Using REST APIs - Smashing Magazine</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b61671e5a3ea" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/restful-api-101-b61671e5a3ea">RESTful API 101</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open Graph Tags in HTML 101]]></title>
            <link>https://medium.com/geekculture/open-graph-tags-in-html-101-5d470bbdb78a?source=rss-963906d24739------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d470bbdb78a</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Megan Lo]]></dc:creator>
            <pubDate>Mon, 14 Jun 2021 06:54:20 GMT</pubDate>
            <atom:updated>2021-07-12T23:05:31.620Z</atom:updated>
            <content:encoded><![CDATA[<h4>A HTML tag that the tutorial doesn’t tell you about</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*VQlYSaBUQocpC4dTGIkQTw.png" /></figure><p>Today, I would like to introduce the open graph tag.</p><p>Let me be honest, I just learned this a few days ago. I always wonder how do people have their website preview display when they share on social media, but not when I share mine? And you know what, turns out the magic is all on this og meta tag. I noticed it is not something that are mentioned in tutorials, at least in all the tutorials that I have watched. SO, hopefully you find your way to this article because you are curious about what “open graph tag” is.</p><p>Open graph tag is introduced by Facebook in 2010. It was created to help optimize Facebook posts by providing more control over the information travel from third-party website when shared on Facebook (for instance, when the post is liked or shared).</p><p>All the open graph meta tags should be in the &lt;head&gt; section in HTML to send the information to the DOM.</p><h4>Why are Open Graph Tags Important?</h4><p>As mentioned earlier, open graph meta tags are created to allow information easier to control on social media, like Facebook. In the marketing perspective, the open graph meta tags can have a massive impact on conversions and click-through rates.</p><p>Think about it, would you click on a link that has neither website preview, title nor descriptions? You might think those are either scam links or you are just simply not interested. That is why open graph meta tags are important to especially marketers!</p><p>In the following section, we are going to explore how we are going to use open graph tags.</p><h4>How to Use Open Graph Tags?</h4><p>Before we start, here’s a quick glance what your open graph tags need to include:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/0*_Ci7xwpMQRm3apyr.jpg" /><figcaption>Credit: <a href="https://neilpatel.com/blog/open-graph-meta-tags/">Neil Patel</a></figcaption></figure><p>Before we start, you need to know that for the og tags are different for Twitter and we’ll look at it in a bit!</p><p>Here are the few things you have to put in as you saw from the picture above: og:image , og:title , og:description and of course there are more depending on your needs.</p><p>Let’s break down what they do and I will be using the example from the picture above to help you understand what’s going on:</p><p><strong>og:title : </strong>it’s quite self-explanatory. This is how you define your content’s title. In the &lt;head&gt; section, this will look like this:</p><pre>&lt;meta property=&quot;og:title&quot; content=&quot;Apple rolls out CarPlay for safely using iPhones in the car&quot; /&gt;</pre><p><strong>og:image : </strong>This is how you ensure the thumbnail of your website shows on social media when you share. This is crucial!</p><p>This is how it will look like:</p><pre>&lt;meta property=”og:image” content=”http://www.yourdomain.com/image-name.jpg” /&gt;</pre><p>Either you get your image from your CMS(content management system) or any open sources, or you can get it from your local file and replace the http://www.yourdomain.com/ with %PUBLIC_URL%/the-name-of-your-image.(whatever source your image is from).</p><p>The most frequently requested resolution for OG image is 1200px x 627px. At this size, your thumbnail will fit perfectly in both large image thumbnail or small image.</p><p><strong>og:description : </strong>This should contains the description of your website, similar to og:title . It helps people understand what your website does.</p><p>This is how it will look like:</p><pre>&lt;meta property=”og:description” content=”Apple has launched its Carplay...” /&gt;</pre><p>There are two more tags that is not in the picture you also have to include:</p><p>1. <strong>og:type : </strong>This tells the DOM how you describe the object you are sharing, whether it is a blog post, website, or video, etc.</p><p>Here are the common examples that you can put inside the og:type tag:</p><ul><li>website</li><li>article</li><li>blog</li><li>book</li><li>game</li><li>movie</li><li>city</li><li>country</li></ul><pre>&lt;meta property=”og:type” content=”website” /&gt;</pre><p>2. <strong>og:url : </strong>This is where you paste the URL of your website to this meta tag.</p><pre>&lt;meta property=”og:url” content=”http://www.yourdomain.com” /&gt;</pre><p>That’s all you need for now!</p><p>As I mentioned earlier, Twitter’s open graph tags look slightly different. Let’s explore that in our next section!</p><h4>Twitter Open Graph Tags</h4><p>As for Twitter, it is called a “card”. Since we have to explore the main part of the open graph tags, I am going to be brief and give you the tag names as reference:</p><ul><li>twitter:card : works quite similarly with og:type . When you share a URL in your tweet, Twitter would look into your file and look for twitter:card and know this is how you want to show your website on Twitter! (I’ll share a screenshot in a bit, then you’ll know how cool it is!)</li></ul><pre>&lt;meta name=”twitter:card” content=”summary” /&gt;</pre><ul><li>twitter:title : works similarly with og:title . Use up to 70 characters.</li></ul><pre>&lt;meta name=”twitter:title” content=”Your title here” /&gt;</pre><ul><li>twitter:description : works similarly with og:description . Use up to 200 characters.</li></ul><pre>&lt;meta name=”twitter:description” content=”description here” /&gt;</pre><ul><li>twitter:url : works similarly with og:url</li></ul><pre>&lt;meta name=”twitter:url” content=”http://www.yourdomain.com” /&gt;</pre><ul><li>twitter:image : works similarly with og:image</li></ul><pre>&lt;meta name=”twitter:image” content=”http://www.yourdomain.com /image-name.jpg” /&gt;</pre><p>BUT WAIT! How do you know if it works or not!? In the next section, we are going to talk about the “debugger”.</p><h4>Open Graph Debugger</h4><p>As a good developer, we always make sure everything works by using debugger. Open graph tags are no exception! Facebook created a <a href="https://developers.facebook.com/tools/debug/">Sharing Debugger</a> specifically for Facebook (unfortunately — for me — you need to log in to be able to use the debugger), so as <a href="https://cards-dev.twitter.com/validator">Twitter</a>, and <a href="https://www.linkedin.com/post-inspector/">LinkedIn</a> has one too!</p><p>(Since I don’t have a Facebook account, I will use LinkedIn as example!) All of these three sites are pretty user friendly (or should I say developer friendly??). All you have to do is to copy the site URL onto the page and it should be able to show you how your website looks like if you share them on your respective social media.</p><p>At this point, I would recommend deploying your website to a host (like Netlify or Heroku) so you can get a link. I have to be honest, I never tried with local host, so I don’t know how it works.</p><p>Let me use my portfolio as an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*eF-Gh8aeNJjLDoK6iuFbKQ.gif" /></figure><p>As you can see, it displays the thumbnail, the title, the URL of the website is displayed on the page. However, I forgot to put the og:description meta tag, therefore there’s a feedback down below. Pretty cool, right? :)</p><p>And with Twitter debugger/Card Validator, you would see this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*v0gC1TZdGtA__PBXgP-qyg.png" /><figcaption>From Twitter’s Card Validator</figcaption></figure><p>This means you have included the Twitter open graph tags in your website. Even if you don’t use Twitter, I think it’s a good rule of thumb to put these tags in the &lt;head&gt; section, who knows you’ll need them one day, right?</p><h4>Meta Tag Generator</h4><p>Before we go, I would like to share this tool I used that helped me generate the meta tags for my website. Sometimes it’s too much to type, it’s always helpful to have a tool to just copy and paste everything. <a href="https://metatags.io/">Meta Tags</a> would generate the open graph tags that you need for your URL. All you have to do is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*sYnWD6D9CZzeHOHFr-DWzQ.png" /></figure><p>Type in the meta data, select the channels that you’d be sharing on and click “generate meta tags” on the right hand corner. It will generate the meta tags for you, which looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*erVPaEaluP_vhTSdzlqH0Q.png" /></figure><p>Pretty cool, right? :)</p><p>That’s how my Tweet looks like when I shared my portfolio:</p><h3>Megan Lo on Twitter: &quot;I did it! I did it! After 4 months of procrastination, I finished building my portfolio within 2 weeks 🙌🏻. I will continue to make updates with the #portfolio, but here you go!! #webdevhttps://t.co/FLhzY8TKll / Twitter&quot;</h3><p>I did it! I did it! After 4 months of procrastination, I finished building my portfolio within 2 weeks 🙌🏻. I will continue to make updates with the #portfolio, but here you go!! #webdevhttps://t.co/FLhzY8TKll</p><h4>Before You Go…</h4><p>This is a relatively short and sweet article. I hope this is informative enough to get you started with open graph tags! I have linked some resources down below if you would like to learn more advanced open graph meta tags and happy coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/0*Ywr1FobCSZBRIKz8" /></figure><h3>Resources</h3><ul><li><a href="https://ogp.me/">Open Graph protocol</a></li><li><a href="https://neilpatel.com/blog/open-graph-meta-tags/">What You Need to Know About Open Graph Meta Tags for Total Facebook and Twitter Mastery</a></li><li><a href="https://ahrefs.com/blog/open-graph-meta-tags/">Open Graph Meta Tags: Everything You Need to Know</a></li></ul><p>Debugger:</p><ul><li><a href="https://developers.facebook.com/tools/debug/">Sharing Debugger - Meta for Developers</a></li><li><a href="https://www.linkedin.com/post-inspector/">Post Inspector</a></li><li><a href="https://cards-dev.twitter.com/validator">JavaScript is not available.</a></li></ul><p>Generator:</p><p><a href="https://metatags.io/">Meta Tags - Preview, Edit and Generate</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d470bbdb78a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/open-graph-tags-in-html-101-5d470bbdb78a">Open Graph Tags in HTML 101</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Very First Hackathon Experience]]></title>
            <link>https://meganslo.medium.com/my-very-first-hackathon-experience-dd963c0a6662?source=rss-963906d24739------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd963c0a6662</guid>
            <category><![CDATA[code-newbie]]></category>
            <category><![CDATA[hackathons]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Megan Lo]]></dc:creator>
            <pubDate>Mon, 31 May 2021 06:10:57 GMT</pubDate>
            <atom:updated>2021-05-31T06:10:57.697Z</atom:updated>
            <content:encoded><![CDATA[<p>(This article is dedicated to those who want to join their first hackathon but not sure what to expect.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*vENIkf7fuWsZWtqoXgLZ_Q.png" /><figcaption>All-Women Hackathon: Choose to Challenge by <a href="https://medium.com/u/859024526e89">The Expat Woman</a></figcaption></figure><p>Two weeks ago, I participated my very first hackathon. I had a hard time finding a hackathon due to the fact that many hackathons are only available to high school students and college students, or grads who graduate within 6 months, which I am nowhere to that (I graduated in Aug 2020 — so close!!). Around a month ago, one of my bootcamp friends shared the All-Women Hackathon event organized by <a href="https://medium.com/u/859024526e89">The Expat Woman</a> on Linkedin. At first, I was intimidated by the fact that the event was going to be 1 week long, but turns out it was one of the best things that had happened during my job search journey.</p><p>Hackathons in general are very welcoming, especially to code newbies and people who have no coding experiences, because you would learn A LOT during hackathons. I saw this Medium article awhile ago that this dude joined a hackathon after learning coding for a few days (Can’t find it at the moment, will attach the link if I could find it). Seeing that guy joining a hackathon as a very newbie while I’ve been coding for more than 6 months, I decided to step out of my comfort zone and sign up for the event. Also, knowing that I would be in a safe space with other talented women, I had a bigger motivation to sign up.</p><h4>Logistics</h4><p>The hackathon was around 1.5 weeks long. I pretty much dedicated most of my time to this hackathon for a week and not doing much job searching-related stuff. There would be investors among the judges, so we were building a project to solve one of these challenges:</p><p><strong>Hackathon Challenge 1</strong>: Find solutions to end gender bias and discrimination in the hiring process and at the workplace so women thrive in their careers and their achievements are celebrated</p><p><strong>Hackathon Challenge 2</strong>: Find solutions to encourage more girls and women to step into STEM fields of studies and work</p><p><strong>Hackathon Challenge 3</strong>: Find solutions to create gender equality in entrepreneurship so women have access to funding, resources and mentors</p><p><strong>Hackathon Challenge 4</strong>: Find solutions to encourage and empower women to reach their goals, achieve their full potential and become leaders in their area of expertise</p><p><strong>Hackathon Challenge 5:</strong> Find solutions to help immigrant or refugee women who are new to a country get access to resources, supportive networks, and opportunities</p><p><strong>Hackathon Challenge 6: </strong>Find solutions to help women in unsafe home or work environments get access to support and resources.</p><p><strong>Hackathon Challenge 7</strong>: Other — a hack project related to our theme “Choose to Challenge”</p><p>(Our team chose Challenge 4.)</p><p>Here’s a breakdown of the timetable (I might be off with the timeline):</p><p>Day 1: Network with other participants and pitch presentations (only if you have pitch ideas and want to have your own team)</p><p>Day 2–3: Team Formation</p><p>Day 4–10: Building projects with your team</p><p>Day 11: Deadline to submit demo, prototype and pitch slides.</p><p>Day 12: Team/Pitch Presentation</p><h4>My Team Experience</h4><p>Each team could have max. of 8 people. In my team, we had 5 UI/UX designers (3 of them knew HTML &amp; CSS), 2 project managers, and then me!— 1 full stack developer. I also have to mention that <strong>most of my team members are career changers: a few of us graduated from bootcamps recently or are self taught</strong>. I believe this was the first time for any of us participated in a hackathon.</p><p>In the first 3 days, we spent a lot of time as a team discussing the business plan and the design of the website. Then, I realized that we only had 7 days to build a project from scratch. As the only full stack developer of the team, the time I had was very very limited to build the entire prototype, given that I had limited experience as well. As a result, I spoke up during our team meeting asking if we could meet individually since all of us were very clear with our roles, therefore we all could have more time and energy to work on our part. After the day, I noticed everything went much faster and BETTER since everyone was very productive and very responsible with their roles. We also took the opportunities to meet the mentors in the hackathon for different advice, including the project design, how to pitch the project better, and programming as well.</p><p>I was very worried at first, because I had the responsibility to build the prototype from scratch to finish (could be imposter syndrome). But I was super grateful that my teammates were very understanding and I had other UI/UX designers/front-end developers to help me out.</p><p>The UI/UX design team did a really great job designing the website. I know it is very common for the developer team to communicate with the design team. I made use of this experience to communicate with the design team more often, so we could be all in the same page with the user flow and user experience, and such. I also spent a lot of time communicating with the project managers to understand what they would like to see in the prototype and for the business pitch.</p><p>During project weeks in my bootcamp, we either worked with other developers who had similar skill sets or worked alone. I like working in teams and this experience had opened my eyes to how it’s like to work with people in different roles and teams.</p><p>I am not sure how other teams in the hackathon collaborated with each other, but I am 100% confident to say that our team has a very good dynamic and everyone’s super chill. I can feel the respect that we had for each other. When one person had any opinions, everyone kept an open ear to listen to each other, which I personally found this type of space quite rare and this is something I valued so much from this hackathon experience.</p><h4>Results of Our Project</h4><p>In the end, guess what? My team won second place! After working on the prototype days and nights, our efforts had finally paid off! Our PMs did such a really great job during the pitch presentation that we got potential investors wanting to invest in our project. However, our team has collectively decided to not continue working on the project. I strongly believe that the project has potential, so maybe someday when we all have more experience, then we can work on this project again.</p><h4>Conclusion</h4><p>If you are looking to join hackathons and you are not sure if you want to, you should go for it, no matter what! Having to build something from scratch within a week from planning to executing and work with other people, to me, that experience is more valuable than anything, especially if you are at the start of your programming journey. Everyone has different hackathon experience, and my first time was certainly very enjoyable. In the meantime, I learned more than I ever did in the past few months of job searching. During the experience, I was constantly forced to step out of my comfort zone, especially implementing features that I never had worked in, like <a href="https://blog.devgenius.io/create-a-multi-step-form-with-reactjs-322aa97a2968">creating multi-step forms</a> or <a href="https://medium.com/geekculture/how-to-use-react-router-useparams-436851fd5ef6">using React Hooks</a>. Before this hackathon, I felt unconfident in myself even though I had built full-stack projects before. Now I just want to keep building more projects and learning more new things and writing more Medium articles about my experience and things I just learned.</p><p>I hope this article could somewhat motivate you if you are still hesitating. I need to say it’s scary to step out of your comfort zone, but IT’S ALL WORTH IT! Feel free to find me on <a href="https://www.linkedin.com/in/megan-s-lo/">LinkedIn</a> if you have more questions about my Hackathon experience!!</p><p>If you are interested, here’s the <a href="https://github.com/mehmehmehlol/STEMStartHer-frontend">Github page</a> of our prototype (not responsive unfortunately :/).</p><p>Preview of our website:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*tKlby119nlWib2wJxDumfA.gif" /></figure><p>I want to thank my teammates: Alyssa (my late night styling buddy who taught me a lot of front-end styling), Emma (who started this project idea and one of the UI/UX designers), Lara, Diane, Amy, Elena and Raylene!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd963c0a6662" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>