<?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 Shem! on Medium]]></title>
        <description><![CDATA[Stories by Shem! on Medium]]></description>
        <link>https://medium.com/@shem10?source=rss-348f0a55055d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*L-9eNkoB53SIatzriNBH5w.jpeg</url>
            <title>Stories by Shem! on Medium</title>
            <link>https://medium.com/@shem10?source=rss-348f0a55055d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 22:13:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shem10/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[Easy Toggle.]]></title>
            <link>https://medium.com/@shem10/easy-toggle-88750ddfcef?source=rss-348f0a55055d------2</link>
            <guid isPermaLink="false">https://medium.com/p/88750ddfcef</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[toggle]]></category>
            <category><![CDATA[easy-toggle]]></category>
            <dc:creator><![CDATA[Shem!]]></dc:creator>
            <pubDate>Thu, 12 Jul 2018 08:03:24 GMT</pubDate>
            <atom:updated>2018-07-12T08:39:14.398Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2quHEQyApxwwwEsFWFGcQ.jpeg" /></figure><blockquote>Have you ever experience in a particular case where you want just toggle a button? showing content on and off?</blockquote><p>If you are working with <strong>angular, react, or vue</strong> or any view library framework that supports reactivity this might help you.</p><p>In this particular example I’ll use vue.js as an example code it does not matter what framework you will use this will work regardless.</p><p>Let’s look at some example.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2Feywraw8t%2F162386%2F&amp;src=https%3A%2F%2Fjsfiddle.net%2Feywraw8t%2F162386%2Fembedded%2F&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/5efa66fabcb3becc971cf3c8709f726d/href">https://medium.com/media/5efa66fabcb3becc971cf3c8709f726d/href</a></iframe><p>It took a little bit line of codes to perform as simple as toggle.</p><h3>A better way</h3><p>Let us think this way, have you ever use the <strong>! (not) </strong>symbol? <br>so what it does is just simply like this <strong><em>(! true = false, ! false = true)</em></strong>, taking that into account.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2FLfcp3uwk%2F1%2F&amp;src=https%3A%2F%2Fjsfiddle.net%2FLfcp3uwk%2F1%2Fembedded%2F&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/185b3bf9bd79cc7503805329cd01da08/href">https://medium.com/media/185b3bf9bd79cc7503805329cd01da08/href</a></iframe><p><strong>Voilà! </strong>It’s more cleaner right? and doesn’t take that much line of codes to implement a <strong>toggle.</strong></p><p>We should opt-in to do simpler approach unless there is a need to do complex stuff.</p><blockquote>Hope this helps! Let me know what you think?</blockquote><h3>Bonus:</h3><p>In-line toggle. Click HTML tab to see.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2FdgnL4p0y%2Fembedded%2Fhtml%2Cresult%2F&amp;src=https%3A%2F%2Fjsfiddle.net%2FdgnL4p0y%2Fembedded%2F&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc80f15d2004946978ae12f8aaed037c/href">https://medium.com/media/dc80f15d2004946978ae12f8aaed037c/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88750ddfcef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Applying “All codes are guilty until proven innocent” in your code.]]></title>
            <link>https://medium.com/@shem10/applying-all-codes-are-guilty-until-proven-innocent-in-your-code-8f7bbfa2975a?source=rss-348f0a55055d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f7bbfa2975a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[clean-your-code]]></category>
            <category><![CDATA[all-codes-are-guilty]]></category>
            <category><![CDATA[refactor]]></category>
            <category><![CDATA[until-proven-innocent]]></category>
            <dc:creator><![CDATA[Shem!]]></dc:creator>
            <pubDate>Wed, 11 Jul 2018 04:06:02 GMT</pubDate>
            <atom:updated>2018-07-11T06:23:32.079Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>A way to clean code.</blockquote><p>Have you heard this quote before?</p><blockquote>All codes are guilty until proven innocent.</blockquote><p>probably not.</p><p>How does it work in real world?</p><p>Here are some examples:</p><p>Let’s say we want to create a new student in the DB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*IR3F6yYDs0Cf-wahBgY4cQ.png" /><figcaption>Example code 1</figcaption></figure><p>Here in the example we use the <strong><em>if.. else…</em></strong> statement, this is perfectly fine and will work as intended, but have you noticed we have 2 nested {} (braces) <strong><em>function { if {} else {}}?</em></strong>, as your code grows it will be not easy to read your code anymore.</p><p>How about we use <strong><em>return </em></strong>statement:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*RVUzzReeEuQpD6uzwNXAKA.png" /><figcaption>Example code 2</figcaption></figure><p>Wow! This feels like more roomier, but still we are not solving the main issue here nesting our main logic inside multiple <strong>{}</strong> braces, so what if we could do the other way around? hmm…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*YgKm0jJC8btHqMNXGoTDVw.png" /><figcaption>Example code 3: All codes are guilty until proven innocent.</figcaption></figure><p>Super! More space and feel more tidier and easy to read, you can get away of unnecessary additional nested braces of your main logic code compare to <strong>example code 1</strong> above.</p><p>This helps eliminate potential distractions and easy to debug 3–6 months from now. There are many ways to improve writing your code but definitely this is one of them.</p><p>This is not an absolute rule that you should follow in your whole application, apply it when you feel necessary.</p><blockquote>Trust your gut!</blockquote><p>Hope this article helps to make your code like an art and great in the eyes :).</p><blockquote>What do you think? Does this helps?</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f7bbfa2975a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplest Custom Error in JavaScript]]></title>
            <link>https://medium.com/@shem10/simplest-custom-error-in-javascript-bf12077b1ae6?source=rss-348f0a55055d------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf12077b1ae6</guid>
            <category><![CDATA[jscustom-error]]></category>
            <category><![CDATA[simplest-js-custom-error]]></category>
            <category><![CDATA[javascript-custom-error]]></category>
            <category><![CDATA[custom-error-class]]></category>
            <category><![CDATA[new-error]]></category>
            <dc:creator><![CDATA[Shem!]]></dc:creator>
            <pubDate>Mon, 25 Jun 2018 10:20:07 GMT</pubDate>
            <atom:updated>2018-06-25T10:32:52.871Z</atom:updated>
            <content:encoded><![CDATA[<h4>Have you ever experience that you need to to throw your own CustomError?</h4><h4>Why not leverage the existing Error Class and extends it.</h4><p>See example below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/578dd131c1c07be6a5327223e9db8344/href">https://medium.com/media/578dd131c1c07be6a5327223e9db8344/href</a></iframe><p>Let me know what you think. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf12077b1ae6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>