<?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 Erick Zhao on Medium]]></title>
        <description><![CDATA[Stories by Erick Zhao on Medium]]></description>
        <link>https://medium.com/@erickzhao?source=rss-92e9576840b0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5AQq8T3oRdEqwunc-wR2dQ.png</url>
            <title>Stories by Erick Zhao on Medium</title>
            <link>https://medium.com/@erickzhao?source=rss-92e9576840b0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 08:53:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@erickzhao/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[Adding Test Coverage to your NodeJS app with Istanbul, TravisCI, and Codecov]]></title>
            <link>https://medium.com/@erickzhao/adding-test-coverage-to-your-nodejs-app-with-codecov-istanbul-and-travisci-aa092c1e360c?source=rss-92e9576840b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa092c1e360c</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[code-coverage]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Erick Zhao]]></dc:creator>
            <pubDate>Sun, 22 Oct 2017 22:20:42 GMT</pubDate>
            <atom:updated>2017-10-22T22:34:48.733Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*OYRNPIuPbhSc4DfyNCrq2Q.png" /></figure><p>A little background: over the past couple weeks, I’ve been working on <a href="https://probot.github.io/apps/invite-contributors/">invite-contributors</a>, a GitHub app that leverages the <a href="https://probot.github.io/">Probot</a> framework to allow organizations to automatically invite new contributors into their organization.</p><p>It’s actually my first foray into deploying a Node app, and I wanted to be like the cool kids and make sure my code quality was adequate by writing tests (even though I currently have &lt;100 LOC in total).</p><p>I used <a href="https://github.com/mochajs/mocha">Mocha</a> and <a href="https://github.com/mjackson/expect">Expect</a> to test my code (they’re the defaults for Probot), and decided I wanted to include a test coverage reporter into my continuous integration flow (which was deploying to Heroku whenever my TravisCI build passed).</p><p>I decided to use <a href="http://codecov.io/">Codecov.io</a> to integrate code coverage with my GitHub repo based on the fact that it had a <a href="https://chrome.google.com/webstore/detail/codecov-extension/keefkhehidemnokodkdkejapdgfjmijf">cute browser extension</a> that integrates into GitHub (didn’t really think to much about it). Codecov in turn recommended <a href="https://istanbul.js.org/">Istanbul</a> to generate coverage reports locally.</p><p>To actually run Istanbul, I used <a href="https://github.com/istanbuljs/nyc">nyc</a> (Istanbul’s official CLI), which integrates well with Mocha (or any other test runner, so I’ve heard). Running tests with Mocha and getting a coverage report with nyc is as easy as running nyc mocha .</p><p>I also decided to split my Travis build into two different scripts in my package.json :</p><ol><li>test runs all Mocha tests locally and reports how much LoC coverage you have (entirely locally).</li><li>report-coverage packages the report and sends the information to Codecov.</li></ol><pre>// package.json<br>...<br>&quot;scripts&quot;: {<br>    &quot;test&quot;: &quot;nyc mocha&quot;,<br>    &quot;report-coverage&quot;: &quot;nyc report --reporter=text-lcov &gt;                coverage.lcov &amp;&amp; codecov&quot;<br>}</pre><pre>...</pre><p>…in the .travis.yml , simply add both scripts to your build:</p><pre>// .travis.yml</pre><pre>...<br>script:<br>- npm run test<br>- npm run report-coverage<br>...</pre><p>…and don’t forget to add reports generated by nyc to your .gitignore :</p><pre>// .gitignore</pre><pre>...<br>.nyc_output<br>coverage<br>*.lcov<br>...</pre><p>This works pretty smoothly for me so far. Now, I can still run npm test to make sure that new code functions as intended, and every Travis build sends updated code coverage information to Codecov.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa092c1e360c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TEAM BUCHAREST at Google Games 2017]]></title>
            <link>https://medium.com/@erickzhao/team-bucharest-at-google-games-2017-2e53bad030c4?source=rss-92e9576840b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e53bad030c4</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[hackathons]]></category>
            <dc:creator><![CDATA[Erick Zhao]]></dc:creator>
            <pubDate>Sat, 23 Sep 2017 21:58:53 GMT</pubDate>
            <atom:updated>2017-09-23T23:23:47.332Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*XviKs2Ub0ucqcER2MQJLDQ.png" /><figcaption>The Google Montreal office</figcaption></figure><p>This past April, I had the amazing opportunity to attend the first edition of Google Games Montreal. I heard about it through some student newsletters, and figured I had nothing to lose: the fun thing about free events is that even monumental failure gets you free food and swag.</p><p>I talked about it with my friends, and we decided that TEAM BUCHAREST (all caps required) was going to make a splash at Google Games. Going in, we had no idea what to expect, aside from eating free food and going on a “secret mission” (the event theme was Secret Agent). That alone was enough to entice us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZThj4_QMNX2-HpEq3O2M_g.jpeg" /><figcaption>(and the free food definitely happened)</figcaption></figure><p>That said, as I was expecting lots of data structure and algorithm questions and had been doing nothing but practical Javascript for the four months prior, I didn’t have very high hopes for the mission itself. (And even lower ones when we realized one of our teammates couldn’t show up that day.)</p><p>However, to my surprise, the event turned out to be way more up my alley, as I’ve always enjoyed online riddles (thanks, <a href="http://notpron.org/notpron/">notpron</a>). Although there were a few straight coding questions here and there, a lot of the challenges were riddles: deciphering song lyrics, word manipulation puzzles, reverse image search scavenger hunts, even a plain oldcrossword puzzle. Each challenge gave you an even number of points, and the teams who solved the most would be declared the winners.</p><p>We capped off the event with a frenzy round (with bonus points) where teams had to guess terms in a word web that related to the “Secret Agent” theme (with associations spanning as far as Selena Gomez and Reese’s Pieces).</p><p>To our surprise, we actually finished in 3rd place after a tight race in the word association round. Although we didn’t win the grand prize of a Google Home (two months before it even came out in Canada), we did get a nice YouTube throw pillow and a Google backpack! All things considered, this was probably the best result for us, especially given that we were only at 80% of our full power.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*VZmzWXf4SAzBGdNTgk0FMw.jpeg" /><figcaption>TEAM BUCHAREST. On the far right: me adjusting my glasses and holding up a picture of our 5th team member</figcaption></figure><p>Overall, it was one of my favourite experiences this year, and I would highly recommend you sign up if you’re a computer science or software engineering student and they host next year’s event in your area!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e53bad030c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Importing global CSS with modules enabled in Webpack 2]]></title>
            <link>https://medium.com/@erickzhao/importing-global-css-with-modules-enabled-in-webpack-2-6dee1b156572?source=rss-92e9576840b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dee1b156572</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[webpack]]></category>
            <dc:creator><![CDATA[Erick Zhao]]></dc:creator>
            <pubDate>Sat, 09 Sep 2017 16:18:32 GMT</pubDate>
            <atom:updated>2017-09-24T05:31:36.564Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WDicMo0-2NsbcgHXuUtqhg.png" /></figure><p>I’m fairly new to React, and I’ve recently tried to implement the <a href="https://github.com/intljusticemission/react-big-calendar">React Big Calendar</a> library into one of my apps, which was using css-loader in Webpack 2 with the modules: true flag to enable CSS modules.</p><p>The documentation for the library instructed me to include a global CSS file into my component, and I spent way too much time figuring out how to do that. import ‘react-big-calendar/lib/css/react-big-calendar.css’ was the most obvious thing to do, and it didn’t work. Webpack would compile, but the styles still wouldn’t show up.</p><p>Turns out that it’s necessary to prefix the file name with!style-loader!css-loader! like so import ‘!style-loader!css-loader!react-big-calendar/lib/css/react-big-calendar.css’ .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dee1b156572" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shallow copying an array of objects in JavaScript]]></title>
            <link>https://medium.com/@erickzhao/javascript-cloning-an-array-of-objects-e184e328901?source=rss-92e9576840b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e184e328901</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Erick Zhao]]></dc:creator>
            <pubDate>Fri, 10 Mar 2017 02:02:10 GMT</pubDate>
            <atom:updated>2017-09-24T05:29:57.975Z</atom:updated>
            <content:encoded><![CDATA[<p>The other day at work, I was faced with an issue where I had to track all user changes to an array of objects between page load and form submission. On the surface, this seemed easy enough: just make a copy of the array with array.slice() and compare it the final state of the original array. Simple, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AitIM8Hnw3HPNVyfrWXg0g.jpeg" /><figcaption>welp.</figcaption></figure><p>Well, it didn’t work. So I did what usually does work when plan A doesn’t. I started at the developer console for about an hour, sprinkling in some StackOverflow searches (with great terms such as <em>“array.slice() broken”</em> and <em>“why won’t array.slice() work”</em>) and speed-reads of MDN documentation between monotonous repetitions of breakpoint debugging. Still nothing.</p><p>Anyways, it turns out <strong>the objects within the array aren’t getting copied, only the array itself. </strong>In other words, while my new array A’ wasn’t pointing to my original array A, all the objects within were referencing the same space in memory. In hindsight, the problem was laughably simple.</p><p>In any case, a quick StackOverflow search led me to find out that JSON.parse(JSON.stringify(obj)) would work just fine.</p><p>Hopefully this ends up helping some other poor Javascript newbie someday. If not, thanks for reading my overly dramatic blog post about how I spent way too much time mulling over a simple issue.</p><p><strong>TL;DR: Array.slice() doesn’t work since the clone of the array will still point to the same objects. Use </strong><strong>JSON.parse(JSON.stringify(obj)) instead!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e184e328901" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Monokai on Eclipse]]></title>
            <link>https://medium.com/@erickzhao/getting-monokai-on-eclipse-d9b37f974fd9?source=rss-92e9576840b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9b37f974fd9</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Erick Zhao]]></dc:creator>
            <pubDate>Sat, 29 Oct 2016 04:24:22 GMT</pubDate>
            <atom:updated>2016-10-29T04:24:22.835Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*A7RmyKbhy0GjMRXMHkzK0g.png" /></figure><p>I’ve always been a stickler for aesthetics. If you’re anything like me, you probably hate Eclipse’s default syntax highlighting colour scheme, which looks like it drew inspiration from a baby’s first attempt at finger painting. There’s just <em>something</em> that just makes staring at code feel like a drag. Fortunately, Eclipse has plugins for custom <a href="http://www.eclipsecolorthemes.org/">colour themes</a> and a nice <a href="https://marketplace.eclipse.org/content/eclipse-moonrise-ui-theme">dark UI</a>. As soon as I figured that out, I looked for the colour scheme I was most familiar with because of Sublime Text: Monokai. Unfortunately, the <em>Sublime Text Monokai Extended </em>and <em>Sublime Text 2 </em>themes packaged with the Eclipse Colour Themes plugin are a bit off (and I don’t even know what their <em>Monokai</em> is supposed to be), most noticeably with the comment colouring being white, which is mildly infuriating to no end.</p><p>Since the Eclipse Colour Themes website just came back up from maintenance (it’s been down since at least the beginning of the semester), I finally got my hands on their theme generator so I could make my own more faithful adaptation of the <a href="http://www.monokai.nl/blog/wp-content/asdev/Monokai.tmTheme">Monokai TextMate theme</a>. I adapted the hex codes from the original theme to fit into the Eclipse Colour Theme generator the best that I could, and gave birth to the (unoriginally titled) <a href="http://www.eclipsecolorthemes.org/?view=theme&amp;id=44675">Monoright</a>.</p><p>Unfortunately, there are limitations to the generator, so there are a couple elements that are still off for Java highlighting, not to mention that the HTML highlighting is completely bogus, but it should be overall a pretty faithful rendition of Monokai for Eclipse. (To actually add tag highlighting for HTML, simply change the hex value for “localVariableDeclaration” from #F8F8F2 to #F92672.)</p><p>Hope that helps!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9b37f974fd9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>