<?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 Nick Wu on Medium]]></title>
        <description><![CDATA[Stories by Nick Wu on Medium]]></description>
        <link>https://medium.com/@nickwu241?source=rss-36aadd247532------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*MQX4gnyFO3kCC7C19lixeg.png</url>
            <title>Stories by Nick Wu on Medium</title>
            <link>https://medium.com/@nickwu241?source=rss-36aadd247532------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 09 Apr 2026 22:06:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nickwu241/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[ Laptop Battery Checker by Nick #SummerSideProjects #1 #2021]]></title>
            <link>https://nickwu241.medium.com/laptop-battery-checker-by-nick-summersideprojects-1-2021-cc88aa3a4276?source=rss-36aadd247532------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc88aa3a4276</guid>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[love]]></category>
            <category><![CDATA[side-project]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Nick Wu]]></dc:creator>
            <pubDate>Sat, 19 Jun 2021 23:36:29 GMT</pubDate>
            <atom:updated>2023-02-01T14:11:42.741Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to Nick’s first #SummerSideProject, today we have the highly anticipated background macbook laptop battery checker in 55 lines of code 🙌. In the future, we hope to see more come to life 🌅, or for him to bring back some of his old ones. 😆</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/0*dTNC4meLvy2bUhSV" /><figcaption><a href="https://www.reddit.com/r/ProgrammerHumor/comments/j2oj5e/cool_side_project/">https://www.reddit.com/r/ProgrammerHumor/comments/j2oj5e/cool_side_project/</a></figcaption></figure><h3>What’s the problem?</h3><p>My macbook is often in the “charging” state but is actually not charging,<br>and sometimes I just forget to plug in my charger 🤦. This causes my laptop to run out of battery while I’m playing video games such as League of Legends or Steam games 😭. Unfortunately this has happened multiple times…</p><h3>How do we solve this?</h3><p>Of course, the answer is let’s code something to solve this. So we’ve created a script that’s always monitoring the battery level since we definitely can’t trust the charging symbol in the mac’s user interface. We’ll make my laptop say “battery is draining” if the battery is not increasing, and “charger is not plugged in” if I didn’t even plug in my charger.</p><p>After coding this up, we just need to run one command to make sure that our battery is always being checked when we are gaming:</p><pre>nohup ./batteryd.py -a Steam|LeagueClient &gt;/dev/null 2&gt;&amp;1 &amp;</pre><h3>Where’s your code?</h3><p>We had to google to figure out how to:</p><ol><li>Get the battery stats from the computer, and determine if the battery is charging or not,</li><li>Determine if an application is running or not because I only want to this script to check the battery if I’m gaming,</li><li>Get the laptop to talk to us.</li></ol><p>Code is at <a href="https://github.com/nickwu241/battery-checker">https://github.com/nickwu241/battery-checker</a> or see the gist below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/367117204c9496e7f4629dcc710c9f92/href">https://medium.com/media/367117204c9496e7f4629dcc710c9f92/href</a></iframe><h3>What’s next?</h3><p>Next up on #SummerSideProjects is a surprise so subscribe to <a href="https://www.youtube.com/channel/UCI-7R1L1ogAarwGgtY6fycQ">Nick Codes on YouTube</a> or follow <a href="https://github.com/nickwu241">nickwu241 on Github</a> to be the first to the fun 😉 #newyearnewnick</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc88aa3a4276" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating an Instagram clone with Flutter ]]></title>
            <link>https://nickwu241.medium.com/creating-an-instagram-clone-with-flutter-4e81eab2ed69?source=rss-36aadd247532------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e81eab2ed69</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Nick Wu]]></dc:creator>
            <pubDate>Tue, 02 Jul 2019 16:42:39 GMT</pubDate>
            <atom:updated>2019-08-26T23:16:16.097Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_TXENGEfPvGgijpjO82ZNA.png" /></figure><p>I tried Flutter recently, it’s super enjoyable, productive and intuitive! 😄 I’ll discuss where Flutter shines and why I like it by showing you an Instagram clone I built.</p><h4>What is Flutter❓</h4><p>It’s a mobile framework for creating Android and iOS applications.</p><p>You write code once using the Dart programming language and ship it to both the App Store and Google Play Store, similar to React Native. Its main selling points are <strong>fast development</strong>, <strong>expressive user interface (UI)</strong>, and <strong>native performance</strong>.</p><h3>Creating Instagroot — Instagram clone for Groot 🌴</h3><p>I only focused on creating the UI and interactions for the Home Feed, take a look at what it looks like below 👻</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FLUpphBjNR5E%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DLUpphBjNR5E&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FLUpphBjNR5E%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9b2d2752f618196ca5b876fa7db40b5/href">https://medium.com/media/f9b2d2752f618196ca5b876fa7db40b5/href</a></iframe><p>I took a top-down approach when building Instagroot:</p><ol><li><strong>Break down the components</strong> and create the layout for them.</li><li><strong>Tackle big components one at a time</strong>: StoriesBar, PostWidget, and CommentWidget.</li><li><strong>Implement the details</strong> for smaller components, for example: avatars have a gradient border if a user has a new story.</li><li><strong>Create the interactions/animations</strong> such as liking a post, double tapping to like a post, commenting, and liking comments.</li></ol><h3>Why I like using Flutter 😍</h3><h4>Composable, intuitive, and fun</h4><p>To create user interfaces in Flutter, you compose many “widgets” (components) together. To me it’s super intuitive and fun!</p><p>I created Instagroot using the <strong>Row</strong>, <strong>Column</strong>, <strong>Stack</strong>, and <strong>ListView</strong><em> </em>widgets for layout. Then using the <strong>Padding</strong> widget to add spacing where needed.</p><p>For example, take a look at the UI and corresponding code for the “photo details” section:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/238/1*A2EVqRZMOyYHRcTdMxMM4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-n3PNORmCpJ3R_Wo0PI34Q.png" /><figcaption>Photo details section UI and code</figcaption></figure><h4>Simple and useful built-in widgets</h4><p>Flutter has many built-in widgets that implement common UI components such as a <strong>Scaffold</strong> (consisting of the <strong>AppBar </strong>and <strong>BottomNavigationBar</strong>),<strong> CircularAvatar, IconButton</strong>, <strong>Icon</strong>, and many more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/1*14OKYa1MYaEAsg3vcM7rcw.png" /><figcaption>Built-in widgets</figcaption></figure><h4>Highly customizable widgets</h4><p>If the built-in widgets alone aren’t cutting it, you can create your custom widgets using some built-in widgets and lower level APIs which give you more fine grain control of pixels. Alternatively, you can find widgets from the nice Flutter community.</p><p>For Instagroot, I implemented custom widgets for the avatars with a <strong>gradient border</strong>, <strong>heart animation</strong> when a photo is double tapped, <strong>photo carousel dots</strong>, and <strong>heart button</strong> for liking comments:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/246/1*JpffX99U4gabKuCfpwssYA.png" /><figcaption>Custom widgets</figcaption></figure><h4>Awesome Tooling</h4><p>It’s easy to setup Flutter and start coding using <strong>VSCode</strong> which feels more lightweight compared to using Android Studio and Xcode. Notable features include:</p><ul><li><strong>Inspect Widget </strong>for figuring out where a UI element is in the hierarchy and the corresponding code for creating it.</li><li><strong>Code Assist</strong> for quickly refactoring widgets such as adding Padding to a widget.</li><li><strong>Hot Reload</strong> so UI changes in your code will be reflected on the emulator or physical device in milliseconds.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgifs.com%2Fiembed%2FmO72j3&amp;url=https%3A%2F%2Fgifs.com%2Fgif%2FmO72j3&amp;image=https%3A%2F%2Fj.gifs.com%2FmO72j3.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gifs" width="480" height="270" frameborder="0" scrolling="no"><a href="https://medium.com/media/09cd2555f98396f448a9d3d2173bf547/href">https://medium.com/media/09cd2555f98396f448a9d3d2173bf547/href</a></iframe><h3>Conclusion</h3><p>Flutter’s fun, easy to use, and I’m pretty productive creating mobile applications using it. You should definitely give it a shot if you haven’t already.</p><p>Thanks everyone for reading and hope you all enjoyed it! ✌️</p><p>📱 <a href="https://play.google.com/store/apps/details?id=wu.nick.instagroot"><strong>Try the app on Google Play Store</strong></a></p><p>❤️ <a href="https://github.com/nickwu241/instagroot"><strong>See the full code on GitHub</strong></a></p><p><strong>Next up</strong>: I’ll be writing blog posts and posting videos on how to create specific Flutter widgets! 😄</p><p>🌈 <a href="https://www.instagram.com/nickwu241/?hl=en"><strong>Find me on Instagram</strong></a><strong><br></strong>🐙 <a href="https://github.com/nickwu241"><strong>Follow me on GitHub</strong></a><strong><br></strong>⭐ <a href="https://www.linkedin.com/in/nick-wu/"><strong>Let’s connect on LinkedIn</strong></a><strong><br></strong>🐦 <a href="https://twitter.com/nickwu241"><strong>Follow me on Twitter</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e81eab2ed69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Internship at Shopify ❤️]]></title>
            <link>https://nickwu241.medium.com/my-internship-at-shopify-%EF%B8%8F-535c2e4a6e81?source=rss-36aadd247532------2</link>
            <guid isPermaLink="false">https://medium.com/p/535c2e4a6e81</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[shopify]]></category>
            <dc:creator><![CDATA[Nick Wu]]></dc:creator>
            <pubDate>Fri, 18 Jan 2019 05:15:23 GMT</pubDate>
            <atom:updated>2019-08-08T20:32:42.156Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog post, I’ll talk about my <strong>internship highlights</strong>, <strong>projects worked on</strong>, and <strong>tips for internship applications</strong> 😃 I worked on the Data Infrastructure team in Ottawa as a Software Engineering Intern from January to August in 2018!</p><h3>Life at Shopify 🦄</h3><h4>Amazing culture &amp; coworkers 🏄🏻</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L8Du4-4cnSQ0WCYC3D2Nng.jpeg" /><figcaption>Cute Ottawa Summer Interns 2018</figcaption></figure><p>I absolutely loved the work culture! Shopify cares a lot about personal growth and gives teams/individuals a lot of autonomy. This means there are many opportunities for personal growth and making an impact, so you’re in control of how much you want to get out of the internship.</p><p>Shopifolks are friendly, open-minded, fun, passionate about the product, and always willing to help one another. I enjoyed surrounding myself with curious people that have strong technical backgrounds and are constantly looking for ways to improve the status quo (both full-timers and interns). Shout out to my mentors/team for knowing so much, supporting me, explaining their decisions, and being a funny bunch.</p><h4>Challenging work 👷</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NaK16LJ5dxldYTBEDIFUrg.jpeg" /><figcaption>Nick hard at work recovering from food coma</figcaption></figure><p>I liked the work I was doing and the technology I was working on so I was excited to go to work everyday.</p><p>The type of work depends on your team and roadmaps but there’s a high chance you’ll be tackling tough and impactful problems with mentorship!</p><h4>Fun office 💚</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LbFMxwADS6ZxZpLAEqb4TA.jpeg" /></figure><p>Shopify’s Ottawa office at 150 Elgin Street is full of personality ❤️ It has around 10 floors and each floor has its own unique theme with various cute spots to work, eat, drink, relax, or play. If you’re ever in Ottawa, I’d recommend taking an office tour.</p><p>I liked that work is flexible because the important part is getting your work done &amp; making an impact. I’d often play foosball, table tennis, Mario Kart, Zelda, pinball, or some other games after work or when I need a break 😄</p><p>Shout out to the amazing culinary team at the Ottawa office! They always make a variety of yummy food. Breakfast and lunch are provided &amp; there are constantly treats at random times averaging once a week or two, they serve all sorts of goodies such as ice cream, waffles, poutine, sliders. Offices are stocked with snacks and drinks too 😉</p><p>I worked in Ottawa but Shopify has offices in Toronto, Montreal, Waterloo and around the world (San Fransisco, Berlin). You can check out <a href="https://www.shopify.com/careers/locations">https://www.shopify.com/careers/locations</a>.</p><h4>Cool events ✌️</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IX9LfAktAt8177KCjdjS4g.jpeg" /></figure><p>Over my 8 months, I went to 3 internal summits/conferences (one company-wide, one for production engineering, one for RnD), 2 intern retreats, 2 internal hackathons where my team won one of them, other team building/celebrating activities, and lots of talks! There are many opportunities to learn, have fun, see what’s happening around the company, meet new people, and eat good food.</p><h3>Life outside the office ⛄</h3><h4>Living by myself &amp; being close to other interns 🔥</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4RVJXA01bjIE1r8SdI5WUw.jpeg" /></figure><p>I’m from Vancouver BC and this was my first time living by myself. It’s great to be independent and I had a lot of time for myself. Interns coming out of the city were all housed at the same building so it was easy to get together to play board games, video games, go out for fun, or chill! Throughout the year, I learned many new board games, got decent at foosball, but not so good at table tennis still… 😆</p><h4>Being a tourist ✈️</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hGSQVTrTb9QSzIikbsTjWw.jpeg" /><figcaption>Ottawa’s a pretty tame and quiet city, but I did see a few places and visit Montreal and Toronto! It’s also close to New York but I didn’t go 😜</figcaption></figure><h4>Going to hackathons 🤖</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*xsbvkKRbkl3b1JVG9PMyxw.jpeg" /><figcaption>Winner winner chicken dinner</figcaption></figure><p>For those that know me, you’ll know how much I like these! On the east coast, there are many more hackathons to attend compared to Vancouver. Extra fun that I won prizes from some these too 😛 <a href="https://nickwu241.github.io">Check out some of my hacks</a>.</p><h3>What I worked on 🚀</h3><blockquote>This section is semi-technical.</blockquote><ul><li>Created a Ruby on Rails 🚈 application to visualize deployments, resources, and access permissions for data projects under Shopify’s Google Cloud infrastructure. This app also runs health checks to enforce good practices and offers an interface to create service accounts, request permissions, etc.</li><li>Created a process for a faster way to analyze audit logs in case of (potential) security breaches. The goal was to get answers to questions such as “who accessed this resource” under an hour for 1000+ TB of event logs ⭐️</li><li>Developed a Scala service to replicate production SQL queries against our data cluster onto a test data cluster. This allowed us to “test” our SQL query engine version upgrades (PrestoDB) in case new versions break backward compatibility or come with huge performance degradations.</li><li>Built a macOS application to abstract away using the command line for connecting to data services. This is good for folks unfamiliar with the command line but probably not too useful at the current moment 😆</li><li>Experimented with using Google Stackdriver and their APIs to leverage the monitoring/alerting offered by Google’s ecosystem. Documented my exploration including pros &amp; cons and some quirks of Stackdriver.</li><li>Developed a command line interface to look at current status of services, deploy services, scale up/down when needed.</li><li>Optimized some Dockerfiles to get faster build times, thus higher developer productivity 🙏</li></ul><p>Over the work term, I used Python, Ruby (Rails), Swift (macOS), Scala, a bit of Java, a bit of Go, systemd, Google Cloud Platform, Kafka, PrestoDB, Mode, Datadog, Splunk. It was my first time using most of these technologies as I only had previous experience with Python, Go, Java, AWS. So I definitely learned a lot on the job!</p><h3>Tips for the Internship Applications 💪</h3><blockquote><strong>Disclaimer:</strong> These are all my own opinions and experiences, the process may have changed and I am not representing Shopify in any way. Use this information at your own discretion.</blockquote><p>Shopify opens up applications roughly 4 months in advance for all 3 terms: fall, winter, summer. Check out <a href="https://www.shopify.com/careers/interns">https://www.shopify.com/careers/interns</a> for deets.</p><ol><li>Spend time on the application and do the extra credit if there are extra credits for the challenge. Most of them involves creating an app.</li><li>Create a unique cover letter that expresses your interests, passions, and your own personality, they do read these! This is important because interns TYPICALLY don’t have as much experience as full-timers, so it’s your passion, desire to learn, problem solving, and communication that counts!</li><li>For the life story interview, be ready to talk about yourself, your interests, how you got to where you are today, why are you interested in the role, why are you passionate about what you’re passionate about. This’ll be with a recruiter.</li><li>For the technical interview, the first half is talking about a project you bring. You should know your project well and ideally worked on most of it, it can be a school project. You’ll talk about your project and demo it, then the interviewers will ask you questions along the way, it’s a technical discussion back and forth. They might ask you how you would change your app if there’re new requirements. You should be ready to justify your technical decisions such as choosing the tech stack, datastore, data structures, algorithms, and anything else that’s specific/applicable to your project (UX flow, routing, selecting 3rd party APIs, deployment process, caching mechanism, etc).</li><li>My whole technical interview was going over my project but I think for 2019 and onwards, the second half should be going over your application challenge you completed. I would say the same tips apply— know what you did and why 😃</li></ol><p>If you came for the tips, I hope this helps and feel free to message me with more specific questions.</p><h3>Thanks for reading! 😍</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3oEduJnper1UdNqreg%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3oEduJnper1UdNqreg%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3oEduJnper1UdNqreg%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="496" frameborder="0" scrolling="no"><a href="https://medium.com/media/43ce9f722b393f5451ced2fd95948e99/href">https://medium.com/media/43ce9f722b393f5451ced2fd95948e99/href</a></iframe><p>Show some love and give this post a 👏 or 50 if you liked it 😉</p><p>Feel free to reach out to me on Instagram, LinkedIn, Twitter about my experiences at Shopify, the interview process, feedback on my post, or pretty much anything!</p><p>🌈 <a href="https://www.instagram.com/nickwu241/?hl=en"><strong>Find me on Instagram</strong></a><strong><br></strong>🐙 <a href="https://github.com/nickwu241"><strong>Follow me on GitHub</strong></a><strong><br></strong>⭐ <a href="https://www.linkedin.com/in/nick-wu/"><strong>Let’s connect on LinkedIn</strong></a><strong><br></strong>🐦 <a href="https://twitter.com/nickwu241"><strong>Follow me on Twitter</strong></a></p><h4>More Technical Posts from Nick</h4><ul><li><a href="https://medium.com/@nickwu241/web-scraping-with-python-part-1-da26397366e1">Web Scraping with Python — Part 1</a></li><li><a href="https://medium.com/@nickwu241/creating-an-instagram-clone-with-flutter-4e81eab2ed69">Creating an Instagram clone with Flutter 😱</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=535c2e4a6e81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Scraping with Python — Part 1 (requests, BeautifulSoup)]]></title>
            <link>https://nickwu241.medium.com/web-scraping-with-python-part-1-da26397366e1?source=rss-36aadd247532------2</link>
            <guid isPermaLink="false">https://medium.com/p/da26397366e1</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Nick Wu]]></dc:creator>
            <pubDate>Wed, 08 Aug 2018 06:41:12 GMT</pubDate>
            <atom:updated>2019-09-19T20:32:06.829Z</atom:updated>
            <content:encoded><![CDATA[<h3>Web Scraping with Python — Part 1 (requests, BeautifulSoup)</h3><p>In Part 1, I’ll show my steps for scraping a website with an example. For instance, I want to create a random quote generator, so first I need a list of quotes — web scraping to the rescue! 🙌</p><p><em>It’ll be helpful to have a basic knowledge of HTML and Python for following along. </em>My example uses Python 3 and requires requests and bs4.</p><h4>1. Find a website you’re interested in scraping</h4><p>I googled “famous quotes” and the first result was <a href="http://www.keepinspiring.me/famous-quotes/">http://www.keepinspiring.me/famous-quotes/</a>.</p><h4>2. Inspect the HTML to find patterns for extraction</h4><p>After navigating to the website, I right clicked the section I was interested in and clicked “Inspect” to show the HTML structure. See below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vSGDwx5BeD3rSNFZ4185VQ.png" /><figcaption>Step by step HTML inspection</figcaption></figure><p>Then I usually open up a few more of the HTML elements, and skim through the whole document to get a sense of the structure.</p><h4>3. Use Python to extract from the HTML document</h4><p>We’ll use BeautifulSoup to parse the HTML and select elements we’re interested in and just print the output for a start:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/daac408b625b4f8fef52bc79d1f944b1/href">https://medium.com/media/daac408b625b4f8fef52bc79d1f944b1/href</a></iframe><p>After running the program (view the script output at <a href="https://gist.github.com/nickwu241/3d9ec7eb46608d4b88164f8e0f9e7ede">https://gist.github.com/nickwu241/3d9ec7eb46608d4b88164f8e0f9e7ede</a>), we get 108 quotes as expected since the post title is <em>“108 famous quotes on life, love, and success”</em>. But some of the output is unexpected, e.g. <a href="https://gist.github.com/nickwu241/3d9ec7eb46608d4b88164f8e0f9e7ede#file-script-output-txt-L65">quotes[64]</a> is empty and <a href="https://gist.github.com/nickwu241/3d9ec7eb46608d4b88164f8e0f9e7ede#file-script-output-txt-L108-L119">quotes[107]</a> has extra text after the quote.</p><h4>4. Refine the Python script</h4><p>We can refine our Python script by inspecting the page and correcting our assumptions about the HTML structure until we’re happy with the results!</p><p>In this example, let’s fix the empty quotes[64] first:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oANcjAeDCU98feZK5DGaEQ.png" /><figcaption>Inspecting the element after “Life isn’t about finding yourself. Life is about creating yourself.”</figcaption></figure><p>This is just an empty div, probably a mistake from keepingspiring.me, a fix is to ignore empty divs.</p><p>Next, we can fix quotes[107] by just taking the first line of text.</p><p>Finally, we can clean up the text content before storing it, i.e. splitting the string into quote, author and removing all quotations &amp; dashes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0aaade46b73e3e30992503a3530ae0de/href">https://medium.com/media/0aaade46b73e3e30992503a3530ae0de/href</a></iframe><p>View the script output file at: <a href="https://gist.github.com/nickwu241/8b3227005d80cdfb6ff2388ccb6faf77">https://gist.github.com/nickwu241/8b3227005d80cdfb6ff2388ccb6faf77</a></p><h4>5. Use the data</h4><p>Now we can use the data for our applications, analysis, etc.</p><p>For me, I created a simple random quote generator using Flask and deployed it on Heroku:</p><ul><li><a href="https://goody-quotes.herokuapp.com/">Goody Quotes</a></li><li><a href="https://github.com/nickwu241/quotes">nickwu241/quotes</a></li></ul><h4>BONUS TIPS FOR PROTOTYPING</h4><p>Most the time will be inspecting the HTML and tweaking your program so:</p><ul><li>get familiar with the BeautifulSoup interface, the docs and Stack Overflow are good: <a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/">https://www.crummy.com/software/BeautifulSoup/bs4/doc/</a></li><li>download the URLs locally to be nice to the server and quicken your iteration cycle</li><li>start simple and have the program crash instead of failing silently when your assumptions are incorrect</li></ul><h3>Closing</h3><p>And that’s it for this part to keep this post short, thank you for reading! 😄 Give this post a 👏 or two if you enjoyed it and let me know what you think, what type of data you’re interested in scraping, and what other types of blog posts you’re interested in reading next! See you next time! 😉</p><p>🌈 <a href="https://www.instagram.com/nickwu241/?hl=en"><strong>Find me on Instagram</strong></a><strong><br></strong>🐙 <a href="https://github.com/nickwu241"><strong>Follow me on GitHub</strong></a><strong><br></strong>⭐ <a href="https://www.linkedin.com/in/nick-wu/"><strong>Let’s connect on LinkedIn</strong></a><strong><br></strong>🐦 <a href="https://twitter.com/nickwu241"><strong>Follow me on Twitter</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da26397366e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to embed a Gist statically in Vue]]></title>
            <link>https://nickwu241.medium.com/embed-a-gist-statically-in-vue-4df59b56b29?source=rss-36aadd247532------2</link>
            <guid isPermaLink="false">https://medium.com/p/4df59b56b29</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[gist]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Nick Wu]]></dc:creator>
            <pubDate>Sat, 07 Jul 2018 01:32:55 GMT</pubDate>
            <atom:updated>2019-08-26T23:04:05.825Z</atom:updated>
            <content:encoded><![CDATA[<p>The easy way to include a Gist is to use the embed URL for the Gist provided by GitHub, for instance:</p><pre>&lt;script src=&quot;<a href="https://gist.github.com/nickwu241/8f0c4c95aa68fe969dcebddd456b6752.js">https://gist.github.com/nickwu241/8f0c4c95aa68fe969dcebddd456b6752.js</a>&quot;&gt;&lt;/script&gt;</pre><p>But including this in a Vue component template results in:</p><blockquote>Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as &lt;script&gt;, as they will not be parsed.</blockquote><p>Oh no! To fix this, we will include the Gist statically by grabbing the HTML/CSS produced by the Javascript code and make it a Vue component.</p><h3>Steps to embed a Gist in Vue</h3><p>Run this command to generate the Gist component Gist.vue, replacing &lt;USERNAME&gt; and &lt;GIST_ID&gt;:</p><pre>python &lt;(curl h<a href="https://raw.githubusercontent.com/nickwu241/vue-static-gist-example/master/to_gist_comp.py">ttps://raw.githubusercontent.com/nickwu241/vue-static-gist-example/master/to_gist_comp.py</a>) &lt;USERNAME&gt;/&lt;GIST_ID&gt; </pre><p>For the curious, this command executes the Python script below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c77be9faef69751334e7e3c5922c43b8/href">https://medium.com/media/c77be9faef69751334e7e3c5922c43b8/href</a></iframe><p>Now just register the component like any other Vue component:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f9640d1b9657615815bc80c2e6de52d/href">https://medium.com/media/9f9640d1b9657615815bc80c2e6de52d/href</a></iframe><p>Here’s what alive example looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CyiX5ZXYRH2ry0g_1aknVw.png" /></figure><ul><li>Live Example: <a href="https://nickwu241.github.io/vue-static-gist-example/">https://nickwu241.github.io/vue-static-gist-example</a></li><li>Example Source: <a href="https://github.com/nickwu241/vue-static-gist-example">https://github.com/nickwu241/vue-static-gist-example</a></li></ul><p>Thanks for reading, 👏 if this helped you out! Check out some of my other posts and see you next time :)</p><p>🌈 <a href="https://www.instagram.com/nickwu241/?hl=en"><strong>Find me on Instagram</strong></a><strong><br></strong>🐙 <a href="https://github.com/nickwu241"><strong>Follow me on GitHub</strong></a><strong><br></strong>⭐ <a href="https://www.linkedin.com/in/nick-wu/"><strong>Let’s connect on LinkedIn</strong></a><strong><br></strong>🐦 <a href="https://twitter.com/nickwu241"><strong>Follow me on Twitter</strong></a></p><h4><strong>My other blog posts</strong></h4><ul><li><a href="https://medium.com/@nickwu241/web-scraping-with-python-part-1-da26397366e1">Web Scraping with Python — Part 1</a></li><li><a href="https://blog.usejournal.com/my-internship-at-shopify-%EF%B8%8F-535c2e4a6e81">My Internship at Shopify ❤️</a></li><li><a href="https://medium.com/@nickwu241/creating-an-instagram-clone-with-flutter-4e81eab2ed69">Creating an Instagram clone with Flutter 😱</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4df59b56b29" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>