<?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 gURLmeetsCode on Medium]]></title>
        <description><![CDATA[Stories by gURLmeetsCode on Medium]]></description>
        <link>https://medium.com/@gURLmeetsCode?source=rss-74b6ebe98cac------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*KobNVV71ufVdQWwccVySrA.jpeg</url>
            <title>Stories by gURLmeetsCode on Medium</title>
            <link>https://medium.com/@gURLmeetsCode?source=rss-74b6ebe98cac------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 21:18:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gURLmeetsCode/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[How to level up from a Junior engineer]]></title>
            <link>https://medium.com/@gURLmeetsCode/how-to-level-up-from-a-junior-engineer-fc825367d2cb?source=rss-74b6ebe98cac------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc825367d2cb</guid>
            <category><![CDATA[level-up]]></category>
            <category><![CDATA[junior-developer]]></category>
            <dc:creator><![CDATA[gURLmeetsCode]]></dc:creator>
            <pubDate>Sun, 12 Jul 2020 18:14:09 GMT</pubDate>
            <atom:updated>2020-07-12T18:14:09.631Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fyKqr-jYa90-O61mkNPDbg.jpeg" /></figure><p>You have your first job out of a Bootcamp or another non-traditional path, and after settling in you are now asking yourself, “How do I drop this ‘junior’ developer stigma?”</p><p>Hopefully, by this point, you have made it clear that you value mentorship. Whether your company has a mentorship program or not, they will respect the fact that you want to grow and improve your craft. So let’s get into the tips that worked for me.</p><p>In the case of a company not having a formalized mentorship program here is what you can do to ramp up:</p><ul><li>Find someone who is senior or has been at the company for a decent amount of time and ask if they would be willing to mentor you.</li></ul><p>Let’s be clear, you will make mistakes, you will feel like an imposter, and you will think you are doing everything wrong. IT IS OKAY! The senior engineer that you look up to and are possibly comparing yourself to was once a junior as well. The difference between you and them is experience and time. Allow yourself to fail fast and often! This is the best way to learn.</p><ul><li>Pair program &amp;&amp; Be the driver</li></ul><p>Pair programming is really crucial to leveling up. First, it will help to feel less daunting and intimidating when navigating through the code base with an experienced partner. Secondly, this gives you an opportunity to understand how an experienced engineer thinks. So when you grab your first ticket be sure to work on it with your mentor or someone that can offer support. Once you get in a position where you feel more comfortable you should suggest being the driver. This will give you a chance to solidify your knowledge, utilize technical terms, and build confidence.</p><ul><li>Be curious</li></ul><p>When you pair program on a bug ticket and the senior engineer seems to wiz through the solution, you should be asking “Why did you decide this was the best approach?” “What are the tradeoffs of solving the problem this way?” The more you get in the habit of asking questions, the more you will be prepared with the appropriate answers when an issue occurs.</p><ul><li>Keep track of your progress</li></ul><p>This is something I started doing recently and I think it is a great way to capture where you started and how far you have come. A great way to do this is with a <a href="https://jvns.ca/blog/brag-documents/">Bragg Document</a>. Here, you get you to write out your goals, what you have learned, and how you have contributed, etc. This document is also a great supplement for performance reviews. It becomes easier to advocate for a promotion or raise when you have documented proof of your value.</p><ul><li>Be patient with yourself</li></ul><p>I believe this is the best tip I can offer. If you want to be the best at what you do then you have to be patient and realize this will not happen overnight. To become a great engineer takes diligence, consistency, and failing a couple of times. You will get there but like with any transformations, you have to trust the process.</p><p>Here are some additional sources that I found extremely helpful:</p><ul><li><a href="https://www.audible.com/pd/Make-It-Stick-Audiobook/B00M0EO7EY">Make It Stick</a></li><li><a href="https://www.amazon.com/Effective-Engineer-Engineering-Disproportionate-Meaningful/dp/0996128107">The Effective Engineer: How to Leverage Your Efforts In Software Engineering to Make a Disproportionate and Meaningful Impact</a></li><li><a href="https://24ways.org/2017/levelling-up-for-junior-developers/">Levelling Up for Junior Developers</a></li></ul><p>Be well and good luck :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc825367d2cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Algo Prep Series: Isomorphic Strings]]></title>
            <link>https://medium.com/@gURLmeetsCode/algo-prep-series-isomorphic-strings-86f34e16ada?source=rss-74b6ebe98cac------2</link>
            <guid isPermaLink="false">https://medium.com/p/86f34e16ada</guid>
            <category><![CDATA[isomorphic]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[leetcode-easy]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[gURLmeetsCode]]></dc:creator>
            <pubDate>Wed, 07 Aug 2019 21:05:56 GMT</pubDate>
            <atom:updated>2019-08-07T21:05:56.835Z</atom:updated>
            <content:encoded><![CDATA[<p>Isomorphic string problem with JavaScript solution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*iiyoMCmKSoRyE-4qqMgLIw.jpeg" /></figure><p><strong>Here are our objectives:</strong></p><ol><li>Define what Isomorphic means</li><li>Look at a coding challenge question</li><li>Solve with JavaScript</li></ol><h3><strong>Let’s get started!</strong></h3><p>So you may have heard of the term Isomorphism in math class or read it in some JavaScript documentation. Perhaps, when you heard the term, you had this reaction…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*bZL39rYSFVMYeWs2sC_TrQ.gif" /></figure><p>If you did react this way, that is totally understandable. Below is the simplified definition and the mathematical definition.</p><blockquote>Isomorphic: (adj) corresponding or similar in form and relations.</blockquote><blockquote>Isomorphism: In mathematics, an isomorphism is a homomorphism or morphism that can be reversed by an inverse morphism. Two mathematical objects are isomorphic if an isomorphism exists between them. An automorphism is an isomorphism whose source and target coincide. <em>source(</em><a href="https://en.wikipedia.org/wiki/Isomorphism"><em>Wikipedia</em></a><em>)</em></blockquote><p>You may be wondering how does this apply to strings? Well, when you see this as a coding challenge, the key is determine if the input strings are the same length. Remember, in order to be isomorphic, the strings have to have corresponding points. In other words, the letters from one word can be remapped to get the second word. Remapping a letter means replacing all occurrences of it with another letter while the ordering of the letters remains unchanged.</p><p><a href="https://leetcode.com/problems/isomorphic-strings/"><strong>Leetcode Coding Challenge</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*aFFDtefG6KVKv89O304jYA.png" /></figure><p>Based on what we know, it should be easier to understand why examples 1 and 3 are true and example 2 is false. However, just in case it is not obvious as to why example 2 is false — let’s work on it together.</p><p>The string “FOO” is the same length as “BAR” but can you spot the key difference from this example and the rest? The difference is the character frequency. “FOO” has repeated letters whereas “BAR” has one occurrence of each letter. Due to this we are unable to remap the letters.</p><h3><strong>Show me the code</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LQhOco16qHXRmWCW9QcSSQ.png" /></figure><p>Happy Coding!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86f34e16ada" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Webpack 4 && React Loadable]]></title>
            <link>https://medium.com/@gURLmeetsCode/webpack-4-react-loadable-b8ca7f66e73a?source=rss-74b6ebe98cac------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8ca7f66e73a</guid>
            <category><![CDATA[react-loadable]]></category>
            <category><![CDATA[lazy-loading]]></category>
            <category><![CDATA[webpack4]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[code-splitting]]></category>
            <dc:creator><![CDATA[gURLmeetsCode]]></dc:creator>
            <pubDate>Tue, 30 Jul 2019 19:42:57 GMT</pubDate>
            <atom:updated>2019-07-30T19:42:57.968Z</atom:updated>
            <content:encoded><![CDATA[<p>A tale of code splitting and react lazy loading</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*eCSSy_KSbFbKpo2cfy3olQ.png" /></figure><p>Straight from the website, here is what Webpack does:</p><p>webpack is a <em>static module bundler</em> for modern JavaScript applications. When webpack processes your application, it internally builds a <a href="https://webpack.js.org/concepts/dependency-graph/">dependency graph</a> which maps every module your project needs and generates one or more <em>bundles</em>. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.</p><p>There are so many new wonderful features in Webpack 4 but I only wanted to highlight the two I have worked with so far.</p><ol><li>It’s amazingly fast, build times decreased from 60 to 98%s</li><li>Overridable API called optimization.splitChunks</li></ol><p>So as a new developer, you may ask why does this matter? Well, being able to code split / lazy load your webpage does amazing things for user experience. Imagine waiting more than 5 seconds for your page to load, that would totally suck, wouldn&#39;t it? Webpack split chunks feature paired with React Loadable will take your loading speed to the next level.</p><p>What is React Loadable? React Loadable is Component-centric code splitting and loading in React. So in plain english, it provides a higher order component that can be set up to dynamically import specific components at specific times. React Loadable makes code splitting possible in a React application. Feel free to read more from the creator <a href="https://jamie.build/react-loadable.html?source=post_page">here</a>.</p><p>What is code splitting? Code splitting is a technique where an application only loads the code it needs at the moment, and nothing more. You only load what you need in that moment in time. Prior to this, most applications would load everything all at once. Again, try to imagine the loading times for these types of applications…</p><p>Ok, I know we have covered alot of ground but hopefully, you are still with me. So let’s see this in action. Check out the code:</p><p>Here is how we would implement react loadable’s HOC (Higher Order Component). In this example, index.js is at the highest part of the component tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W67vHk_Sx_Wk1sT9YSCdvg.png" /></figure><p>In this example, we are using the <strong>route-based splitting</strong>. In this secenario components are loaded according to the current route. So let’s go over what this code is doing, we pass a function as a value to loader which returns the component, and we make use of import() to dynamically import it. The fallback UI we want to render before the component is imported is returned by loading(). In this example, we are returning a div element, though we can also put a component in there instead if we want.</p><p>Let’s look at how we would add webpack to the mix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BWxzXX7d3QSE72XKcua67Q.png" /></figure><p>If you have used webpack before alot o this may look familar so I will not go into detail of every line of code. Let’s specifically look at output, plugins and optimization.</p><p>On line 15, we added the chuckFIlename for dynamic importing. This option determines the name of non-entry chunk files.</p><p>As for the plugins, we are leveraging CleanWebpackPlugin which allows us to start off with a fresh build pack every time you run a webpack script. We are also using the HtmlWebpackPlugin. The <a href="https://github.com/jantimon/html-webpack-plugin">HtmlWebpackPlugin</a> simplifies creation of HTML files to serve your webpack bundles. This is especially useful for webpack bundles that include a hash in the filename which changes every compilation. You can either let the plugin generate an HTML file for you, supply your own template using <a href="https://lodash.com/docs#template">lodash templates</a>, or use your own <a href="https://webpack.js.org/loaders">loader</a>.</p><p>In this scenario, the HTML rendered is coming from template.html and then is being loaded into our public folder. The reason you would use this is so you can properly link your webpack bundle(s) to the HTML.</p><p>As for the optimization, this prevents duplication. Prior to ‘SplitChunksPlugin’ we were using the CommonChunkPlugin. The <a href="https://webpack.js.org/plugins/split-chunks-plugin/">SplitChunksPlugin</a> allows us to extract common dependencies into an existing entry chunk or an entirely new chunk. Cache groups can inherit and/or override any options from splitChunks.*; but test, priorityand reuseExistingChunk can only be configured on cache group level.</p><p>In this example, we created a vendors chunk, which includes the initial code from node_modules in the whole application. This method allows us to only include our core frameworks and utilities and dynamically load the rest of the dependencies.</p><p>Here is what you get when you run your bundling script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eo92pSqN-kCHdlgv2aS9YA.png" /></figure><p>Now we have an application that will run lightening fast!</p><p>Want more information, check out this cool <a href="https://youtu.be/tnwDajQ2Yms">youtube video</a>!</p><p>Happy Coding, folks!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8ca7f66e73a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging with confidence]]></title>
            <link>https://medium.com/@gURLmeetsCode/debugging-with-confidence-7f83847288c4?source=rss-74b6ebe98cac------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f83847288c4</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[scientific-method]]></category>
            <dc:creator><![CDATA[gURLmeetsCode]]></dc:creator>
            <pubDate>Sat, 18 May 2019 21:01:38 GMT</pubDate>
            <atom:updated>2019-05-18T21:01:38.284Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*WkrT1MJaxjZFcHuN47Le7Q.png" /></figure><p>Most recently I was learning redux and really struggled with understanding the errors I was getting and how it all worked. I came to the realization, when it comes to programming 70% of your time is spent debugging and the remaining 30% is actually coding.</p><p>So why do we get bugs in the first place? If you google “debugging” this is how the term is defined:</p><blockquote>noun</blockquote><blockquote><strong>the process of identifying and removing errors from computer hardware or software.</strong></blockquote><p>This definition assumes the issue is with the logic but I would like to believe the issue stems from your mental model. Computers will perform whatever task we program it do but the reason the code gives errors is due the disconnect from our understanding and the expectation. With that being said, I think its worth confirming your understanding of how data is flowing throughout your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*ZNiW5-rDzOSDrH3YImtQ2g.png" /></figure><p>In my case, the types of redux errors I was getting were things like “route error” or “this.props.getStudents() is not a function” so this meant I had to retrace my steps from top to bottom. For instance, if I was attempting to submit a form and add the form data to the database through the dispatch function my steps would look like this:</p><ul><li><strong>START</strong>: fire handleSubmit() in form component</li><li>invoke thunk creator from props</li><li>API request inside thunk creator</li><li>middleware directs data to approriate place</li><li>Database request</li><li>Add instance/ row to DB</li><li>Promise returned in variable “response”</li><li>Res.send(response.data)</li><li>Received by thunk creator / resolved promise</li><li>dispatch action creator with response data</li><li>reducer parses info and rewrites state</li><li>state updated</li><li>back in the form component</li><li><strong>END</strong>: prop should render updated state</li></ul><p>As you can see there are alot of steps involved and errors can happen anywhere in that process. The key is having the clear understanding which will allow you to create a roadmap.</p><p>In summary, when you come across some errors and want to throw your computer in the river, try these tips:</p><ol><li>Retrace your steps. Try understanding how data is flowing throughout your application.</li><li>Consider using the scientific method. Check out this blog post to learn more!</li></ol><p><a href="https://www.rithmschool.com/blog/debugging-like-a-scientist">Debugging Like a Scientist</a></p><p>Happy Debugging!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f83847288c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Isomorphism….]]></title>
            <link>https://medium.com/@gURLmeetsCode/isomorphism-2c13b256b1aa?source=rss-74b6ebe98cac------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c13b256b1aa</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[isomorphic]]></category>
            <category><![CDATA[isomorphic-applications]]></category>
            <category><![CDATA[jquery]]></category>
            <dc:creator><![CDATA[gURLmeetsCode]]></dc:creator>
            <pubDate>Fri, 04 Aug 2017 16:52:09 GMT</pubDate>
            <atom:updated>2017-08-04T16:52:09.009Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OF0xEMkWBv-69zvmNs6RDQ.gif" /></figure><p>This post was inspired by a recent project. I was making an HTTP request and ran into some issues. I posted my question on stackoverflow and received numerous responses that not only helped me to solve the problem but also helped me discover the concept of isomorphism. Im sure some new developers can relate to the knee jerk reaction to using jQuery for all AJAX requests. Until recently, I was that developer! I had become so dependent on it, I did not stop to think that there could be better alternatives. So lets talk about isomorphism!</p><p><strong>The Basics: Conceptualization</strong></p><p>Lets start with the general definition of Isomorphism:</p><p><em>Isomorphism means corresponding or similar in form and relations.</em></p><p>So in relation to web development, a JavaScript application deemed “isomorphic” is an application that can run both client-side and server-side (in most cases it is a single-page application that can be run on server).</p><p><strong>Isomorphic Libraries</strong></p><p>Now that we have an idea of what isomorphism means, lets tackle the concept of isomophic libraries. An example of an isomorphic library would be ReactJS. ReactJS is an open source library developed by Facebook, that operates as the V in MVC (Model, View, Controller). What makes ReactJS isomorphic is its ability to be rendered server side. It means a NodeJS server is able to parse your ReactJS components and return the HTML to the browser.</p><p>Isomorphic library V.s jQuery library</p><p>I believe the argument can be made, that choosing an isomophic library for data fetching over jQuery AJAX request is more a developer preference. For instance, if you are concerned with optimal performance you may opt for an isomorphic fetching library. JQuery performance or the lack there of, may not be noticeable in smaller applications but for large production grade applications, this is the less than ideal choice.</p><p>For those who may be interested in the debate of if we as developers need jQuery, check out this post:</p><p><a href="https://mmikowski.github.io/why-jquery/">https://mmikowski.github.io/why-jquery/</a></p><p>The author gives in depth reasons as to why we need jQuery and when to use it.</p><p><strong>Advantages of Isomorphism</strong></p><ul><li>For Isomorphic SPA’s, the first page request is fast and subsequent ones are even faster; as opposed to common SPAs, where the first request is used to load the application and then a round trip is made to fetch what was requested.</li><li>There is less code, as it is shared by both the client and the server.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qRSgTPnRpp0z--KGFRZWAQ.png" /></figure><p>Image above illustrates the differences between an Isomorphic application and a server rendered applcation. In an Isomorphic website, server rendered HTML is returned to the client on the first page request. The HTML contains special markup that allows an asynchronously loaded client-side SPA to attach and handle future rendering on the client. As the user changes views or pages, the client-side SPA completely takes over navigation and rendering, only using the server for API requests as needed.</p><p><strong>Why it matters?</strong></p><p>The initial SPA page can be slow to load because of the time it takes to load and parse client side JavaScript. While this delay is only a matter of a few seconds or milliseconds, users can become impatient and leave the site causing a company to lose revenue.</p><p><strong>Practical Use:</strong></p><p>Here is a snippet of code, displaying how you would integrate the npm isomorphic library, isomorphic-fetch.</p><pre>require(&#39;es6-promise&#39;).polyfill();</pre><pre>require(&#39;isomorphic-fetch&#39;);<br></pre><pre>fetch(&#39;//offline-news-api.herokuapp.com/stories&#39;)</pre><pre>.then(function(response) {</pre><pre><strong>if</strong> (response.status <strong>&gt;=</strong> 400) {</pre><pre><strong>throw</strong> <strong>new</strong> Error(&quot;Bad response from server&quot;);</pre><pre>}</pre><pre><strong>return</strong> response.json();</pre><pre>})</pre><pre>.then(function(stories) {</pre><pre>console.log(stories);</pre><pre>});</pre><p>The key to understanding how the fetch works is within the .then() promise and callback function. The promise represents the eventual result of an asynchronous operation. It is a placeholder into which the successful result value or reason for failure will materialize. In this case, a promise fulfilled is a sucessful callback response and a rejection is due to a failed callback.</p><p><strong>Additional Resources:</strong></p><p>If you are interested in integrating ismorphic libraries in your projects, you should check out some of these:</p><ul><li><a href="http://rendrjs.github.io/">RendrJS</a></li><li><a href="https://www.meteor.com/">Meteor Software: A Platform to Build, Host, Deploy and Scale Full-Stack Javascript Applications</a></li><li><a href="https://www.npmjs.com/package/isomorphic-fetch">isomorphic-fetch</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c13b256b1aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reduce Vs For-Loop]]></title>
            <link>https://codeburst.io/reduce-vs-for-loop-3c1a84e63872?source=rss-74b6ebe98cac------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c1a84e63872</guid>
            <category><![CDATA[higher-order-function]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[gURLmeetsCode]]></dc:creator>
            <pubDate>Tue, 27 Jun 2017 20:22:55 GMT</pubDate>
            <atom:updated>2021-10-12T16:46:18.896Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*uLdDWIVkbIkYNQOnkQRD8Q.jpeg" /></figure><p>I was working through some JavaScript Functional Programming examples when I came across the reduce method. By definition reduce is used to iterate through an array and condense it into one value.</p><p>This caused me to wonder what was the programmatic difference between reduce and a traditional for-loop?</p><p>Here is an example of the reduce method in action:</p><pre>var array = [4,5,6,7,8];<br>var singleVal = 0;</pre><pre>var singleVal = array.reduce(function(previousVal, currentVal) {<br>  return previousVal + currentVal;<br>}, 0);</pre><p>The pattern above stores the return value from the reduce method. The reduce method receives a callback function with the parameters previousVal and currentVal. As the array is being iterated each elements is being added together.</p><p>Here is the same input but with a for-loop</p><pre>var array = [4,5,6,7,8];<br>var singleVal = 0;</pre><pre>for(var i = 0; i &lt; array.length; i++){<br>  var singleVal = singleVal += array[i];<br>}</pre><p>The same result is achieved with a for-loop. For each pass, the element or array[i] in this case, is added and stored in singleVal.</p><p>So I decided to test the two algorithms and see which performed better. Here are the results from jsPerf.com</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1-IoNJh3vXAai_TmjtiuQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zdbCpfSRQZBhke6KNRY0hw.png" /></figure><p>As you can see the for-loop outperformed the reduce method when the sample size was relatively small. Alternatively, the reduce method out performed the for-loop when the sample size was larger.</p><p>The results from the tests showed me the benefits to using one over the other based on the input however, it did not explain the programmatic difference I was looking for. So I decided to keep looking…</p><p>Eventually, I found the answer!</p><p>Reduce in JavaScript is the alias for Fold, a higher order function that analyzes a recursive data structure and through use of a given combining operation, recombine the results of recursively processing its constituent parts, building up a return value. In simpler terms, the elements are combined in a way that reflects the combination with the next element, and so on until all elements are exhausted.</p><p>Folds, maps are used to transform each value of a data structure independently, and filters are used to eliminate some elements from the data structure. Using for-loops as a jack of all trades tends to obscure the actual operation the loop performs. So from a programming standpoint, reduce is more eloquent and clear in its purpose.</p><p>In summary, we are able to determine the distinctions between the two approaches are contingent upon input and the design pattern of the programmer.</p><p>Happy Coding!</p><p>If you are interested in more tech content from me, follow me @nspiredTech on Twitter and Dev.to</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c1a84e63872" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/reduce-vs-for-loop-3c1a84e63872">Reduce Vs For-Loop</a> was originally published in <a href="https://codeburst.io/">codeburst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[…have you met BEM?]]></title>
            <link>https://codeburst.io/have-you-met-bem-15864c642a61?source=rss-74b6ebe98cac------2</link>
            <guid isPermaLink="false">https://medium.com/p/15864c642a61</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[bem]]></category>
            <dc:creator><![CDATA[gURLmeetsCode]]></dc:creator>
            <pubDate>Fri, 16 Jun 2017 03:45:32 GMT</pubDate>
            <atom:updated>2017-10-08T19:46:58.805Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*nBj0wuGclMVD5-uLuEuA3Q.jpeg" /></figure><p>I was recently working on a project when I got introduced to the BEM methodolgy. I loved it so much that I decided to share! So first things first, what is BEM?</p><p>BEM is a popular <em>naming convention</em> for classes in HTML and CSS. <a href="https://en.bem.info/">Developed by</a> the team at Yandex, this methodology helps to better understand the relationship between the HTML and CSS in a given project. BEM makes your CSS modular and limits the cascade (inheritance). This means no more worrying about specificity!</p><p>Let’s break it down even further. Here is the meaning behind the acronym:</p><p>B: Block</p><ul><li>A logically and functionally independent page component, the equivalent of a component in Web Components.</li></ul><p>Example: header, footer, sidebar or main content area would be considered a block.</p><p>E: Elements</p><ul><li>A constituent part of a block that can’t be used outside of it. Each element is written after the block connected by two underscores.</li></ul><pre>block__element{}</pre><p>Example: If the header is the block, then a logo would be considered an element of that block.</p><p>M: Modifiers</p><ul><li>A BEM entity that defines the appearance and behavior of a block or an element. Modifiers are similar in essence to HTML attributes. The same block looks different due to the use of a modifier. To do this, you add a double hyphen -- after the element (or block).</li></ul><pre>.header__navigation--secondary {}</pre><p>Example: Staying with the header — logo example. Let’s say you are using a “mobile first” technique and the logo that is used for desktop viewports is larger than the image used for smaller devices. You could implement this behavior with a modifier.</p><p>So now that you have an idea of what BEM does, lets see it in action.</p><p>Example of HTML</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br>  &lt;header class=&quot;header header__title header__title--small&quot;&gt;Header&lt;/header&gt;<br>  &lt;div&gt;<br>    &lt;article&gt;Article&lt;/article&gt;<br>    &lt;nav&gt;Nav&lt;/nav&gt;<br>    &lt;aside&gt;Aside&lt;/aside&gt;<br>  &lt;/div&gt;<br>  &lt;footer&gt;Footer&lt;/footer&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>Example of CSS</p><pre>.header__title {</pre><pre><strong>background</strong>: #008cba;<br><strong>padding</strong>: 1rem 0;<br><strong>margin</strong>: 2rem 0;<br><strong>text-transform</strong>: uppercase;</pre><pre>}</pre><pre>.header__title--small {</pre><pre>   @mixins atSmall {</pre><pre><strong>     background-color: </strong>#dfe0e0;<br>     font-weight: 200;<br>     font-size: 15px;</pre><pre>   }</pre><pre>}</pre><p>Reasons why you should consider BEM:</p><ul><li>As a favor to your future self, this methodology will help to make sense of class names and allow you to update css styling without residual effects. Hooray for reusability!</li><li>BEM helps to reduce the CSS footprint which means avoidance from a bloated code base.</li><li>Major companies like Twitter and Google, use BEM. Familiarizing yourself with this technique could leverage other opportunities.</li></ul><p>Interested in knowing more? Check out these links:</p><p>Official Documentation for BEM</p><p><a href="https://en.bem.info/methodology/">Methodology</a></p><p>Detailed write up featured on Toptal</p><p><a href="https://www.toptal.com/css/introduction-to-bem-methodology">Introduction to BEM Methodology</a></p><p>Video Tutorial from Reval Govendar</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FYsf0LhP8jus%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DYsf0LhP8jus&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FYsf0LhP8jus%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/2a4ba865bb221642286c4974d1d9d929/href">https://medium.com/media/2a4ba865bb221642286c4974d1d9d929/href</a></iframe><p>Hopefully you found this information helpful and will consider using it for your next project.</p><p>Happy Coding :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15864c642a61" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/have-you-met-bem-15864c642a61">…have you met BEM?</a> was originally published in <a href="https://codeburst.io/">codeburst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Noob-Tip: anchor tag scraping with Nokogiri]]></title>
            <link>https://medium.com/@gURLmeetsCode/noob-tip-anchor-tag-scraping-with-nokogiri-4508796cfcf5?source=rss-74b6ebe98cac------2</link>
            <guid isPermaLink="false">https://medium.com/p/4508796cfcf5</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[rubygems]]></category>
            <category><![CDATA[nokogiri]]></category>
            <dc:creator><![CDATA[gURLmeetsCode]]></dc:creator>
            <pubDate>Tue, 30 May 2017 17:22:41 GMT</pubDate>
            <atom:updated>2017-05-30T17:22:41.964Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*jufRsklgAXG3UvzbFCdiAw.jpeg" /></figure><p>In Japanese culture, a Nokogiri or saw, is used for woodwork and carpentry. It is especially useful due to its precision, cross-cutting, and scraping. In Ruby, we use the Nokogiri Gem with the same expectation, precise scraping.</p><p>For those who are unfamiliar with the gem and would like to try it out, I would suggest visiting the following sites:</p><p>For more in-depth video tutorial:</p><p>“<a href="https://www.youtube.com/watch?v=4TpBH5z8EXA&amp;t=915s">https://www.youtube.com/watch?v=4TpBH5z8EXA&amp;t=915s</a>”</p><p>Gem documentation:</p><p><a href="http://www.nokogiri.org/tutorials/installing_nokogiri.html">Installing Nokogiri - Nokogiri 鋸</a></p><p>Now for the reason you are here, anchor tags!</p><p>After banging my head on the wall trying to get all the anchor tags from a webpage, I came across this helpful pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*euqROQPBVuu1bFBKaJ8O_g.png" /><figcaption><a href="https://stackoverflow.com/questions/7107642/getting-attributes-value-in-nokogiri-to-extract-link-urls">https://stackoverflow.com/questions/7107642/getting-attributes-value-in-nokogiri-to-extract-link-urls</a></figcaption></figure><p>In Nokogiri you have 2 options to scrape attributes, you can use .css(“the name of attribute(s)”) or you can use xpath(“.//the path[@to=’’]/the/anchor”). In the solution provided above, you would use xpath(“//div/a/@href”) to target all the attributes named “href”. To get a visual, you could say, you are grabbing a href than is within anchor tag, that is within a div.</p><p>So if you want to grab all the anchor tags value/text you could do something like this:</p><pre>doc.xpath(&#39;//div/a/@href&#39;)<br># underscore sets the variable to the value executed on the previous line.<br>anchor_tags = _<br>anchor_tags.find_all do |links|<br>  puts &quot;#{links.text}&quot;<br>end</pre><p>or</p><pre>doc.xpath(&#39;//div/a/@href&#39;).text.strip</pre><p>Now for the cherry on top. Let’s say you have this huge HTML document and you have no idea where to begin to grab the data that you need. Let me introduce you to XPath Helper. XPath Helper is a chrome extension that will help you determine the xpath for any given element.</p><p>More information and Install guide, can be found here:</p><p><a href="https://chrome.google.com/webstore/detail/xpath-helper/hgimnogjllphhhkhlmebbmlgjoejdpjl">XPath Helper</a></p><p>Hopefully this information is useful. Let me know if you find other tips and tricks for scraping.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4508796cfcf5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Webpack 2 and Next.js]]></title>
            <link>https://medium.com/@gURLmeetsCode/getting-started-with-webpack-2-and-next-js-a1c4d4161c1?source=rss-74b6ebe98cac------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1c4d4161c1</guid>
            <category><![CDATA[webpack-2]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[gURLmeetsCode]]></dc:creator>
            <pubDate>Fri, 26 May 2017 13:22:58 GMT</pubDate>
            <atom:updated>2017-05-26T13:31:25.032Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jOKnBK5qSfdzw5krm8aNpQ.jpeg" /></figure><p>So in my poor attempt to learn React and build a React App project folder from the ground up, I found myself in a place of frustration. For anyone who has attempted to understand Webpack 2, you can understand where I am coming from. I searched left and right for a tutorial that simplified the core principles of Webpack, needless to say I came up empty handed.</p><p>For my fellow novice developers here is Webpack 2 in a nutshell: Webpack is a module bundler for your Javascript. It complies all your files into a single path which serves as your output. For a more in depth explanation, head over to Drew Powers Blog.</p><p><a href="https://blog.madewithenvy.com/getting-started-with-webpack-2-ed2b86c68783">Getting Started with webpack</a></p><p>For those looking to master Webpack 2 in a e-learning setting, you can check out this course offered from Udemy. For $10 you can go from zero to hero!</p><p><a href="https://www.udemy.com/webpack-2-the-complete-developers-guide/">Webpack 2: The Complete Developer&#39;s Guide - Udemy</a></p><p>Now for the Next.js. Next.js is a more opinionated Create React App. It allows for a quicker setup with less tooling. Here are some of the highlights: Server and client rendering out of the box, Filesytem for routing using ‘/pages’ directory, component life-cycle to encapsulate data requirements, automatic code splitting, automatic transpiling and bundling with webpack and babel, and hot reloading.</p><p>Next.js is the perfect minimalist framework for those suffering from JS fatigue. Don’t take my word for it, check it out for yourself here:</p><p><a href="https://zeit.co/blog/next2">Next.js 2.0</a></p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1c4d4161c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>