<?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 Sheldon Led on Medium]]></title>
        <description><![CDATA[Stories by Sheldon Led on Medium]]></description>
        <link>https://medium.com/@sheldonled?source=rss-fe93ff323db6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TmdNms0KXMM1vIUwZyqxww.jpeg</url>
            <title>Stories by Sheldon Led on Medium</title>
            <link>https://medium.com/@sheldonled?source=rss-fe93ff323db6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 15 Apr 2026 09:26:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sheldonled/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[10 cool things you might not know about CSS]]></title>
            <link>https://medium.com/@sheldonled/10-cool-things-you-might-not-know-about-css-d52e59d83ed3?source=rss-fe93ff323db6------2</link>
            <guid isPermaLink="false">https://medium.com/p/d52e59d83ed3</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Sheldon Led]]></dc:creator>
            <pubDate>Wed, 17 Jul 2019 15:40:50 GMT</pubDate>
            <atom:updated>2019-07-17T15:40:50.443Z</atom:updated>
            <content:encoded><![CDATA[<p>The 3rd one is just awesome 🤩</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Scrn99wIUMVhaEqIM1ic0w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ikukevk">Kevin Ku</a> on <a href="https://unsplash.com/photos/aiyBwbrWWlo">Unsplash</a></figcaption></figure><p>Before I start, I just want to say that this is not about new features, or features yet to be released. This is about things that have &quot;always&quot; been there, or new stuff that might have not gotten as much attention to some people, or just interesting things or fun facts about the language.</p><h4>1. <a href="https://www.google.com/search?q=css+is+awesome&amp;tbm=isch">The &quot;CSS is awesome&quot; meme</a></h4><p>I believe this is the most famous CSS meme out there, followed by the <a href="https://www.google.com/search?q=css+family+guy&amp;tbm=isch">&quot;css family guy&quot; meme</a>. You might have seen this somewhere, in a T-shirt, a mug or a sticker, and everybody can relate to it because it represents the frustration when trying to do a very basic thing in CSS and it doesn’t work properly, but what people don&#39;t realize is that the &quot;CSS is awesome&quot; meme is actually a feature, not a bug!</p><p>If you had a design software that couldn&#39;t to text overflowing a box, you&#39;d be creatively limited and pissed off. CSS Tricks has a big <a href="https://css-tricks.com/css-is-awesome/">post on the &quot;CSS is awesome&quot; meme</a> if you want to learn more, but this happens basically due to 3 things</p><ul><li>The content doesn&#39;t fit into its container</li><li>The container can&#39;t expand to fit the content</li><li>The overflow CSS property has its default to visible.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FqzeapE%3Fheight%3D600%26slug-hash%3DqzeapE%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FqzeapE&amp;image=https%3A%2F%2Fscreenshot.codepen.io%2F107946.qzeapE.small.0b7a7fac-63e7-40e7-8f10-4bb5a15ed8be.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/a28ec4754c3b0b904adbfcb627de804b/href">https://medium.com/media/a28ec4754c3b0b904adbfcb627de804b/href</a></iframe><h4>2. Filters and gradients</h4><p>It&#39;s amazing to see how many mainstream effects are possible to be done with CSS nowadays. You find yourself much more amazed if you&#39;re old enough to have coded websites using images for gradients, or for border-radius for example. Gradients have native CSS support, and you can actually add multiple gradients and have very fun compositions.</p><p>The example below is using the <a href="https://www.meetup.com/DublinCSS/">Dublin CSS</a> logo, which has some gradients, and I&#39;ve also added some cool effects on the codepen below that are now possible with CSS. I&#39;ve also put some filters that you can play with and see them in action. <em>If you happen to be in Dublin, please look for </em><a href="https://www.meetup.com/DublinCSS/"><em>Dublin CSS</em></a><em> events, it&#39;d be really nice to have you there 😊.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FJQgraJ%3Fheight%3D600%26slug-hash%3DJQgraJ%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FJQgraJ&amp;image=https%3A%2F%2Fscreenshot.codepen.io%2F107946.JQgraJ.small.79f38a92-c0a1-4b00-9d76-9c074e2c00b2.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/69adca1c26d4deb2caf6245711c3eedb/href">https://medium.com/media/69adca1c26d4deb2caf6245711c3eedb/href</a></iframe><h4>3. Emojis as class names (or ids)</h4><p>If you have been playing around with the codepens I&#39;ve put here, you might have already noticed that I&#39;m using emojis as class names and ids. HTML is a very powerful language and supports <a href="https://en.wikipedia.org/wiki/List_of_Unicode_characters">unicode symbols and icons</a>.</p><p>I find this one very cool, because it makes your code more fun, but also because it&#39;s inclusive, enabling humans that don&#39;t use eastern alphabet to have their native alphabet at least for classes and ids on CSS. However, this is not a good practice, and people actually <a href="http://adrianroselli.com/2017/10/avoid-emoji-as-class-names.html">advise against using it</a>, but for fun or on a personal project I&#39;d say it doesn&#39;t hurt, right?</p><h4>4. CSS Units</h4><p>The CSS units available are pretty cool, starting by the relative ones: percentage, em, rem. The em and rem are relative to the font-size, and the percentage is relative to the parent. Interestingly enough, you can have block elements with widths in em and the font-size they&#39;re based on in percentage, then it can reach to a point where there&#39;s no parent, and I actually already wrote an <a href="https://codeburst.io/css-units-a-brief-digress-d06e511d7303">article about it</a>, which has the &quot;CSS is awesome&quot; meme as feature image 😄, so I&#39;d recommend you to read it if you want to know more.</p><p>Then you have absolute units, like px which is the most used one, but you also have units that are based on physical measures, starting with Points (pt) which is 1/72 of an inch, and or picas (pc)(12 points). These are the less common one, but Quarter millimeters (q), millimeters (mm), centimeters (cm), or inches (in) are used in our everyday life, and on the web is quite useful when you need to print something that has a specific size.</p><p>Then there&#39;s these two that deserve a codepen, ex, ch: Respectively these are the height of a lower case x, and the width of the number 0. These are not as commonly used or well-supported, and I only see them being used when you have text content using a monospace font.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FbXbENw%3Fheight%3D600%26slug-hash%3DbXbENw%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FbXbENw&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c87e04aa3ecdbe626f43d911d4ecddf/href">https://medium.com/media/4c87e04aa3ecdbe626f43d911d4ecddf/href</a></iframe><p>Lastly I just want to mention the fr unit. It is a short for <em>fraction</em>, and represents a fraction of the available space in a container. There&#39;s this <a href="https://www.youtube.com/watch?v=ZPtpzuRajzM">great video from Jen Simmons</a> that explains it and what problems it solves in a quite simple way.</p><h4>5. Viewport Units</h4><p>This one deserves a topic of its own. Viewport units are the vw (viewport width) and vh (viewport height), and they&#39;re a percentage of the viewport, meaning when a block element has a width of 60vw it means this element will have a width of 60% of the device&#39;s browser window width (in other words, its viewport width). It&#39;s just amazing! Before there was no way of doing this, and we had to use 100% everywhere to try to get this behavior, or use JavaScript. Now it just works!</p><p>The only gotcha I’ve experienced so far is, when you content grows a scroll bar will eventually appear, and this will change the vw value, which could cause a side scrolling. What people usually do is to overflow-x: hidden on the container, then this problem won&#39;t happen.</p><h4>6. Alternative unit for rotate</h4><p>I promise this is the last one about CSS units. <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform">CSS transform</a> is an amazing CSS feature that allows you to do lots of stuff, and rotate is one of them. I&#39;ve used and seen it being used a lot, and the majority of times I&#39;ve seen it, people were using it with degrees, which is quite straightforward if you had proper math education and learned trigonometry at school.</p><pre>transform: rotate(180deg); 🙃</pre><p>However, you can use <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/angle">rotate with other units as well</a>, and the second most common is the rad, short for Radians, and you can have also Gradians (grad). But these are all <em>boring</em>, you can rather use a cool one called turn.</p><p>Turn doesn&#39;t rely on your math skills, it&#39;s just a turn! So if you apply a half turn on the emoji 🙂, it would be rotated to 🙃.</p><pre>transform: rotate(0.5turn); 🙃</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FpMzENd%3Fheight%3D600%26slug-hash%3DpMzENd%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FpMzENd&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/f685948ec605ecc95d888d7cbc2bf41b/href">https://medium.com/media/f685948ec605ecc95d888d7cbc2bf41b/href</a></iframe><h4>7. CSS variables</h4><p>They&#39;re officially called <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties">CSS custom properties</a>, but let&#39;s be honest here, everybody call them CSS variables, the same way everybody says ES6 instead of ES2015 😁. This amazing feature brings natively one of the main reasons of using pre-processors: ability to have variables in CSS. Maybe that&#39;s why they&#39;re so known as CSS variables, but they have a bigger purpose.</p><p>There&#39;s an @ rule <a href="https://tabatkins.github.io/specs/css-apply-rule/">currently in draft</a> called <a href="https://tabatkins.github.io/specs/css-apply-rule/">@apply</a>. This pretty much enables mixins natively, which is the second main reason of using CSS pre-processors. <a href="https://caniuse.com/#feat=css-variables">CSS custom properties are available in all modern browsers</a>, and they&#39;re scoped, meaning they can be at ::root level, or at an element level. You can tweak the codepen below to understand more. Lastly, they can be easily changed with javascript 🤩.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FwVwPzb%3Fheight%3D600%26slug-hash%3DwVwPzb%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FwVwPzb&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/b90aa84639354672d1a6589bd42cef60/href">https://medium.com/media/b90aa84639354672d1a6589bd42cef60/href</a></iframe><h4>8. Pointer events</h4><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events">pointer-events CSS property</a> basically allows you to control if an element will react to the cursor or clicks. This one becomes really cool when you need to style something (like a select box) but the element has limitations on styling. You can simply put a div in front of it, disable <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events">pointer-events</a> and done 😲. Other example is when you mix images and text, in some cases it may happen that the user wants to select the text but ends up dragging the image. If you disable <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events">pointer-events</a> on the image, your problems are gone.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FGVKxgX%3Fheight%3D600%26slug-hash%3DGVKxgX%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FGVKxgX&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/ccfc260c69a3c89e69fe6d9eddb63ef7/href">https://medium.com/media/ccfc260c69a3c89e69fe6d9eddb63ef7/href</a></iframe><h4>9. Calc</h4><p>Calc is just amazing when you need to mix units to have a size of something. Say you have a sidebar of 300px width and you want the content of the website to take the rest of the browser width, you can use calc for that:</p><pre>width: calc(100vw -300px);</pre><p>You can use calc for other hacks, like having responsive font-sizes without media queries, or designing the medium full-width picture, <a href="https://www.youtube.com/watch?v=PKVKwluRTfo">as this video explains</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FpMzLMP%3Fheight%3D600%26slug-hash%3DpMzLMP%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FpMzLMP&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/30984bfdaaa363d32c210965ca8eab2e/href">https://medium.com/media/30984bfdaaa363d32c210965ca8eab2e/href</a></iframe><h4>10. Shorthand Properties</h4><p>Some CSS properties, like <em>margin</em>, <em>background</em>, <em>font</em>, allow you to declare groups of values in one <a href="https://htmldog.com/guides/css/intermediate/shorthand/">shorthand property</a> separated by spaces. This cool thing about CSS is specific to properties like margin and padding, where you have something like this:</p><pre>margin: 15px 5px 2px 20px;</pre><p>How do you know which ones is applied to what?</p><p>The <a href="https://unsplash.com/photos/aiyBwbrWWlo">pic at the top of this post</a> gives you a hint 😉</p><p>This <a href="https://stackoverflow.com/questions/25744942/order-of-css-margin/25745014">Stack overflow question</a> has a list of techniques that the community uses to know which one is which, being the most common one the <a href="http://www.vcarrer.com/2010/01/css-shorthand-clockwise-rule.html">Clockwise rule</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*8W6mHkiJjiVsWsVKwcRktg.png" /><figcaption><a href="http://www.vcarrer.com/2010/01/css-shorthand-clockwise-rule.html">Clockwise rule</a>: Top, Right, Bottom, Left</figcaption></figure><p>A lot of people also use the <strong>TR</strong>ou<strong>BL</strong>e technique, which relies on the fact that the word <em>trouble</em> has letters in an order that reminds the CSS shorthand order. Some other people use the North, East, South, West strategy, which is similar with the clockwise rule. I think the clockwise rule is more universal, I like watches with pointers, some people don&#39;t and some people can&#39;t understand it, so they might go to the other techniques, you do you 🙂.</p><h4>Bonus cool thing</h4><p>This one should&#39;ve made into the list, but so have other cool stuff. However I&#39;m adding this one anyway because my mind blew the first time I saw it.</p><p>Have you ever noticed that, in some websites, when you select some text the color of the selection is different than the default one?! The thing is that you can do this pretty easily with CSS by using ::selection property:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FMNgGyO%3Fheight%3D600%26slug-hash%3DMNgGyO%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FMNgGyO&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/06970002923419d806837f6a3515e1f5/href">https://medium.com/media/06970002923419d806837f6a3515e1f5/href</a></iframe><h3>CSS is really awesome</h3><p>This list could go endless here. As I said, this doesn&#39;t focus on the shinny new stuff, but could&#39;ve been. I could&#39;ve also included things like <a href="http://animista.net/">animations</a>, <a href="https://redstapler.co/10-stunning-css-3d-effect-must-see/">3d stuff</a>, <a href="https://bennettfeely.com/clippy/">CSS clip-path</a>, which are all mind blowing, or even the <a href="https://css-tricks.com/basics-css-blend-modes/">CSS Blend Modes</a>. Let me know in the comments which one should&#39;ve made to this list and I might do a round 2 of this post 😇.</p><h3>References</h3><ul><li><a href="https://www.youtube.com/watch?v=iODambgMZhk">Don’t Use My Grid System or any others</a>, <a href="https://twitter.com/mirisuzanne">Miriam Suzanne</a></li><li><a href="https://css-tricks.com/css-is-awesome/">CSS is Awesome</a>, <a href="https://css-tricks.com/">CSS-Tricks</a></li><li><a href="https://www.sitepoint.com/10-css-css3-resources-tools/">10 Must Know CSS and CSS3 Resources and Tools</a>, <a href="https://www.sitepoint.com">Sitepoint</a></li><li><a href="https://syntax.fm/show/105/hasty-treat-css-and-js-pointer-events">Hasty Treat — CSS and JS Pointer Events</a>, <a href="https://syntax.fm/">Syntax.fm</a></li><li><a href="https://syntax.fm/show/146/css-the-cool-parts">CSS the 😎😎😎 Cool Parts</a>, <a href="https://syntax.fm/">Syntax.fm</a></li><li><a href="https://syntax.fm/show/097/hasty-treat-uses-for-css-variables">Hasty Treat — Uses for CSS Variables</a>, <a href="https://syntax.fm/">Syntax.fm</a></li><li><a href="https://syntax.fm/show/107/hasty-treat-css-units">Hasty Treat — CSS Units</a>, <a href="https://syntax.fm/">Syntax.fm</a></li><li><a href="https://codeburst.io/css-units-a-brief-digress-d06e511d7303">CSS Units, a brief digress</a>, <a href="https://twitter.com/sheldonled">Sheldon Led</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Values_and_units">CSS values and units</a>, <a href="https://developer.mozilla.org">MDN</a></li><li><a href="https://www.youtube.com/watch?v=ZPtpzuRajzM">FR Units in CSS Grid</a>, <a href="https://twitter.com/jensimmons">Jen Simmons</a></li><li><a href="https://www.impressivewebs.com/alternative-units-css3-rotate-transforms/">Alternative Units for CSS3 Rotation Transforms</a>, <a href="https://www.impressivewebs.com">Impressive Webs</a></li><li><a href="https://css-tricks.com/fun-viewport-units/">Fun with Viewport Units</a>, <a href="https://twitter.com/mirisuzanne">Miriam Suzanne</a></li><li><a href="https://web-design-weekly.com/2014/11/18/viewport-units-vw-vh-vmin-vmax/">Viewport units: vw, vh, vmin, vmax</a>, <a href="https://web-design-weekly.com">Tim Severien</a>.</li><li><a href="https://www.youtube.com/watch?v=PKVKwluRTfo">calc() lets you do some real CSS magic</a>, <a href="https://www.youtube.com/user/KepowOb">Kevin Powell</a></li><li><a href="http://adrianroselli.com/2017/10/avoid-emoji-as-class-names.html">Avoid Emoji as Class Names</a>, <a href="http://adrianroselli.com/">Adrian Roselli</a>.</li><li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events">CSS pointer-events</a>, <a href="https://developer.mozilla.org">MDN</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path">Clip-path</a>, <a href="https://developer.mozilla.org">MDN</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d52e59d83ed3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dublin DevFest 2018]]></title>
            <link>https://medium.com/@sheldonled/dublin-devfest-2018-7f026580b017?source=rss-fe93ff323db6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f026580b017</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gdg]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Sheldon Led]]></dc:creator>
            <pubDate>Mon, 26 Nov 2018 13:58:18 GMT</pubDate>
            <atom:updated>2018-11-26T13:58:18.346Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MEd4ct803FIyciJegb1dwQ.jpeg" /><figcaption>Dublin DevFest18 starting, <a href="https://twitter.com/GDGDublin/status/1063736037246148609">via Twitter</a></figcaption></figure><p>On 17th and 18th of November 2018 we had our DevFest in Dublin. If you <a href="https://devfest.withgoogle.com/">don’t know what DevFest is</a>, I suggest you to <a href="https://devfest.withgoogle.com/#devfest-map">look for one near you</a>, because they are community-led, developer events hosted by GDG (Google Developer Groups) chapters around the globe focused on community building and learning about Google’s technologies.</p><p>Although they’re supported and driven by Google and their technologies, you can find a lot of relevant knowledge that goes beyond that, if you’re not into Google stuff (which is quite an unlikely scenario these days isn’t it?!). <a href="https://dublin-devfest-2018.firebaseapp.com/">The Devfest in Dublin</a> happens at <a href="https://www.eventbrite.ie/e/dublin-devfest-2018-tickets-51364812537">Google’s office</a>, which is a cool venue, where the <a href="https://www.meetup.com/GDG-Dublin/">GDG Dublin meetups</a> also happen every month-ish.</p><p>The 2018 DevFest in Dublin had 250 attendees in a 2 day event. The first day was a <a href="https://dublin-devfest-2018.firebaseapp.com/schedule/2018-11-17">full day of talks</a>, with <a href="https://dublin-devfest-2018.firebaseapp.com/speakers/">great speakers from different parts of the world</a>. The second day was a Hackathon day, in which we’d use any Google Technologies (preferably the ones tackled the day before) and the theme was “ Ireland Connected”.</p><h4>First Day — Talks</h4><p>People’s experience in conferences are different because of several aspects, like different backgrounds or interests, but on top of that, having more than one track increases the variety of what people would think about <a href="https://twitter.com/hashtag/DevFest18">#DevFest18</a>. This year we had <a href="https://dublin-devfest-2018.firebaseapp.com/schedule/">3 tracks</a> with a mix of Android, Web and Cloud technologies.</p><p>I’ve focused on talks about Web, however the ones that have gotten my attention more were <a href="https://twitter.com/marcacohen">Marc Cohen</a>’s <a href="https://dublin-devfest-2018.firebaseapp.com/schedule/2018-11-17?sessionId=109">Superpower User Manual</a>, and <a href="https://twitter.com/granttimmerman">Grant Timmerman</a>’s <a href="https://dublin-devfest-2018.firebaseapp.com/schedule/2018-11-17?sessionId=104">All About Apps Script,</a> being the latter the tech I used in my Hackathon project in the Second day. At the end I’ll link the max amount of slides I can find =)</p><h4>Second Day — Hackathon</h4><p>As said above, the hackathon had very few rules. Your idea should be related with “Ireland Connected” theme and use any Google Technologies. The teams were formed at 10:30am and the ideas were presented at 5:30pm. I don’t remember what the winner’s project were about in detail but their general idea was to connect people using cloud technologies. <a href="https://twitter.com/GDGDublin/status/1064225671063527426">The winners earned a Google home device</a>, being the first place 1 each team member, and second place one for the whole team (so they can fight to death for it :D ).</p><p><strong>My team didn’t win any award, but we won the laughs</strong>. Our idea was to incorporate silly things into <a href="https://developers.google.com/apps-script/reference/spreadsheet/">Google Sheets</a> using <a href="https://script.google.com">App Scripts</a> to be a resource for bored people. So we’d fetch information about the weather, funny random gifs, random jokes or phrases etc. Below you can see who it worked:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UnhgXyGn9nur4puIkc5E9w.gif" /><figcaption><a href="https://dublin-devfest-2018.firebaseapp.com">Hackathon project on DevFestDublin</a></figcaption></figure><p>When we presented, everybody laughed at the random things appearing on top of a very boring spreadsheet. We thought that connecting Ireland was related to human feelings, and being bored is a frequent one, depending on what you’re doing.</p><h3>Slides</h3><ul><li><strong>Building a Note Progressive Web App powered by Firebase</strong>, Juarez Filho: <a href="https://bit.ly/firelist-angular-slides">https://bit.ly/firelist-angular-slides</a></li><li><strong>Notions about Motions</strong>, Maurice Gavin: <a href="https://github.com/mauricegavin/NotionsAboutMotions">https://github.com/mauricegavin/NotionsAboutMotions</a></li><li><strong>Superpower User Manual</strong>, Marc Cohen: <a href="https://bit.ly/mco-superpowers">https://bit.ly/mco-superpowers</a></li><li><strong>All About Apps Script</strong>, Grant Timmerman: <a href="https://github.com/grant/talks">https://github.com/grant/talks</a></li><li><strong>Using Machine Learning APIs in the Google Cloud</strong>, Marc Cohen: <a href="https://g.co/codelabs/dublin">https://g.co/codelabs/dublin</a></li><li><strong>Android Room with a View</strong>, Henna Singh : <a href="https://codelabs.developers.google.com/codelabs/android-room-with-a-view-kotlin/#0">https://codelabs.developers.google.com/codelabs/android-room-with-a-view-kotlin/</a></li></ul><p>I’ll update the list if I find more =)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f026580b017" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From JSHint to ESLint]]></title>
            <link>https://medium.com/@sheldonled/from-jshint-to-eslint-8a0a135fa2bf?source=rss-fe93ff323db6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a0a135fa2bf</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[eslint]]></category>
            <category><![CDATA[jshint]]></category>
            <category><![CDATA[linter]]></category>
            <dc:creator><![CDATA[Sheldon Led]]></dc:creator>
            <pubDate>Mon, 17 Sep 2018 19:59:52 GMT</pubDate>
            <atom:updated>2018-09-25T20:35:20.332Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f3l1bu97-xUO8tzCw62bbQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/vS7LVkPyXJU?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Philip Swinburn</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Last year I changed my Javascript linter from JSHint to ESLint. I wasn’t so sure why this change would improve the project so I started my work by reading about both tools. I found some advantages on ESLint over JSHint, and I want to highlight here:</p><ul><li>JSHint rules are a bit confusing. Some of them do something if true (enforcing) and others do something if false (relaxing)</li><li>ESLint has way more built in rules</li><li>Some ESLint rules are more flexible and configurable</li><li>ESLint makes it possible to write your own rules</li><li>ESLint has more support for JSX and ES6 (we’d need these at some point)</li><li>ESLint has a clearer error messaging, showing which rule is causing the error</li></ul><p>Considering that the project was big, I couldn’t just turn off one tool and enable the other. I had to go through every rule on JSHint and configure its equivalent on ESLint. I found some sources on how to do that, but I decided to double check each rule. Also because I wanted to learn a bit more.</p><p>The project was using an older version of the JSHint default configuration file, as I went to JSHint website and saw more recommended rules there. So I mapped each rule enabled on the project JSHint file to ESLint ruleset and enabled all recommended ESLint rules that didn’t require refactoring .</p><p>The rules in JSHint that I didn’t find an equivalent on ESLint were:</p><ul><li><strong>maxerr</strong>: Maximum error before stopping</li><li><strong>es5/esnext</strong>: They’re not rules in ESLint but environment sets.</li><li><strong>moz</strong>: Allow Mozilla specific syntax (extends and overrides esnext features). Unless you develop specifically for the Firefox web browser you don’t need this option</li></ul><p>I borrowed the ruleset, changed a little bit (because it was tailored for this specific project) and <a href="https://github.com/sheldonled/sheldonled.com/blob/master/config/eslintrc.json">used in my website</a>. I’ll probably <a href="https://github.com/sheldonled/mariaquerviajar/blob/master/config/eslintrc.json">use this ruleset in some other projects</a> because it’s very clear and explicit (doesn’t use “extend or plugins”), so I can easily use it and mix it to fit the needs of these future projects. Here’s the comparison between all the rules of JSHint and ESLint:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FrZqpNd%3Fheight%3D600%26slug-hash%3DrZqpNd%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FrZqpNd&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F107946.rZqpNd.small.cb237829-28cd-40eb-8386-253d4e0cfb99.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8c8a87e83bc7d7993f49e6a165a440a/href">https://medium.com/media/b8c8a87e83bc7d7993f49e6a165a440a/href</a></iframe><h3>References</h3><p>[Sitepoint] A comparison of JavaScript Linting Tools: <a href="https://www.sitepoint.com/comparison-javascript-linting-tools/">https://www.sitepoint.com/comparison-javascript-linting-tools/</a></p><p>[Slant] JSHint vs ESLint: <a href="https://www.slant.co/versus/8627/8628/~jshint_vs_eslint">https://www.slant.co/versus/8627/8628/~jshint_vs_eslint</a></p><p>[vs-archive] JSHint rule mapper: <a href="https://github.com/vs-archive/eslint-rules-mapper/blob/master/lib/jshint/jshintRulesMap.js">https://github.com/vs-archive/eslint-rules-mapper/blob/master/lib/jshint/jshintRulesMap.js</a></p><p>[Rico Sta. Cruz] cheatsheet for JSHint: <a href="http://ricostacruz.com/cheatsheets/jshint.html">http://ricostacruz.com/cheatsheets/jshint.html</a></p><p>[Petar Bojinov] JSHint error messages: <a href="https://gist.github.com/pbojinov/9011392">https://gist.github.com/pbojinov/9011392</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a0a135fa2bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How web performance, CSS Grid and PWA are related]]></title>
            <link>https://itnext.io/how-web-performance-css-grid-and-pwa-are-related-873c68f385a9?source=rss-fe93ff323db6------2</link>
            <guid isPermaLink="false">https://medium.com/p/873c68f385a9</guid>
            <category><![CDATA[progressive-web-app]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[grid]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sheldon Led]]></dc:creator>
            <pubDate>Thu, 01 Mar 2018 19:32:22 GMT</pubDate>
            <atom:updated>2018-03-15T13:40:00.113Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KC3RTyxsbu5wGlRAGPNBvQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/SJWPKMb9u-k?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Maico Amorim</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><a href="https://www.linkedin.com/cws/share?url=https%3A%2F%2Fitnext.io%2Fhow-web-performance-css-grid-and-pwa-are-related-873c68f385a9"><em>Click here to share this article on LinkedIn »</em></a></p><p>It is very exciting to work with the web because it’s continuously evolving and we always have something new to learn. One of the most important things when it comes to software engineering on the web is performance, and in this post I’ll describe how some of these new technologies can improve the performance in your application.</p><p>Since these technologies are not very new (aging in the web is a bit faster than in real life) they have a very good browser support, meaning that you can implement them in your software today.</p><h3>Performance on the web</h3><p>Much has been preached about network performance. You have to minify your JS and CSS files to ease the download, you have to compress your images, you have to enable gzip, you have to enable caching etc, but not much word on what’s nice to do after that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LSqEuYyX9A5aZnGCY50Y7g.png" /><figcaption><a href="https://twitter.com/StephenGundee/status/712650972133138433">A tweet from @StephenGundee</a></figcaption></figure><p>Let’s understand what <a href="https://github.com/alex/what-happens-when">happens when you request a page in your browser</a>. Giving a short and simplified response, if the request is successful and you requested a HTML object, the browser will:</p><ul><li>Get the HTML;</li><li>Parse the HTML and identify external resources;</li><li>Download (server or cache) resources: images, fonts, JS, CSS…</li><li>Parse / Render these resources (some of these tasks are concurrent, which may block the rendering)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YACd8YOl3HB9IyXKP9usIw.png" /><figcaption>Image taken from @jaffathecake slides (video: <a href="https://vimeo.com/254947206">https://vimeo.com/254947206</a>)</figcaption></figure><p>This critical rendering path is the responsible for making you see a blank page when you hit enter in the browser address bar. This name is quite nice because it’s a <strong>path</strong>, from the moment the browser receives the text from the server, identifies it as a HTML document, parses it, encounters the resources, downloads them, builds the render tree, then mounts the layout of the page and paints it.</p><p>It’s <strong>critical</strong> because if it’s not optimized it does extra work before showing something to the user. It makes sense to wait for all the CSS to be applied to show the page to the user, because otherwise the user would see content in a way and then it’d suddenly change when the CSS is applied. Same for the font. But for the Javascript it doesn’t make sense. That’s why you should always defer or async your script tags.</p><p>Things are done in the main thread in the browser, so while your JS is being executed, it occupies the main thread and it blocks the user’s interaction with the page. There are two nice talks about how JS works in the browser, one by <a href="https://www.youtube.com/watch?v=8aGhZQkoFbQ">Philip Roberts</a> and the other by <a href="https://vimeo.com/254947206">Jake Archibald</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qjbCcOLSwL_Mu0BbLUgknQ.png" /><figcaption>Browser struggling with all the tasks (I don’t remember where I got this image)</figcaption></figure><p>There are plenty of techniques to reduce the work on the critical path such as <em>lazy load</em> the images that aren’t in the user’s view, inline the CSS necessary to render the <em>above the fold</em> part of the website and <em>lazy load</em> the rest (via JS), lazy-load or load asynchronously the JS for the website, just to name a few. As mentioned in the beginning these are very famous techniques, but what’s next?</p><p>After you download the resources, they still need to be parsed and applied/executed. So the bigger your JavaScript is, the more the browser will work, it doesn’t matter how much you <em>lazy load</em> it. It might be fine to parse/eval this amount of code in your laptop, but mobile devices (and old devices in general) might struggle with that.</p><p>While you might have 8+ GB of RAM in your Desktop, with an i5 or i7 very powerful CPU, you’ll have between 2 to 4 GB in a Samsung device, even less in an iPhone, with a not that powerful CPU and you need to share this power with the opened apps, OS, and to add on top of that, mobile devices:</p><ul><li>Are not plugged (JS drains battery);</li><li>Have less storage, less memory, less powerful CPUs</li><li>Less reliable connection</li><li>However they have very powerful (usually up-to-date) browsers</li></ul><h3>Perceived Performance</h3><p>I believe that by now you’ve noticed the importance of clearing the critical path. A result of a short and smooth critical path is an improvement on the user’s perceived performance:</p><ul><li>People primarily consume the web visually;</li><li>We have to focus on the content the user sees first (so called <em>above the fold</em>);</li><li>Delay/async/defer download of resources: images, fonts, JS and CSS;</li><li>Worry about Render blocking: JS and CSS;</li><li><a href="https://vimeo.com/254947206">Be careful with Parsing &amp; Painting</a></li></ul><p><a href="https://twitter.com/paulirish">Paul Irish</a> gave a short talk in 2015 on <a href="https://www.youtube.com/watch?v=2ksXo2_Lfl0">how users perceive the speed of the web</a>. In this talk he mentioned the RAIL model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1FcKSEb7hdXW5eig1U9toA.png" /><figcaption><a href="https://twitter.com/paulirish">Paul Irish </a>— <a href="https://www.youtube.com/watch?v=2ksXo2_Lfl0">How Users Perceive the Speed of The Web (2015)</a></figcaption></figure><p>So first the page loads (ideally in about one second), the user spend some time seeing what’s in the screen, then they interact with the screen by scrolling for example, then they click or perform some action, this might go to another page and the rhythm goes on and on.</p><p>You might not get your page to be rendered and interactive in 1sec but you should measure what could be better or if your website got worse after a few releases, and here are some tools:</p><ul><li><a href="http://www.webpagetest.org/">WebPagetest</a></li><li><a href="https://gtmetrix.com/">GTmetrix</a></li><li><a href="https://pageweight.imgix.com/">Page Weight (imgix)</a></li><li><a href="https://developers.google.com/web/tools/lighthouse/">Lighthouse</a></li><li>DevTools (i.e. Chrome &gt; DevTools &gt; Performance Tab)</li><li><a href="https://developers.google.com/web/progressive-web-apps/checklist">PWA checklist</a></li></ul><p>Remember:</p><blockquote>While you may not support non-JavaScript users, your users are basically non-JS while they’re downloading, parsing and executing your JS files</blockquote><blockquote><a href="http://estelle.github.io/jsframeworks">Estelle Weyl — JS Frameworks</a></blockquote><h3>Write Less Code</h3><p>It feels like I’m trying to run away from the problem when I say “write less code” like “If there’s no code, there’s no bug,” but there’s some truth in this statement. <a href="http://youmightnotneedjquery.com/">You might not need jQuery</a> or that other lib that you’re including just to perform a small job.</p><p>JavaScript has evolved a lot in the last couple of years and has implemented loads of things natively, so think twice before adding code to your app.</p><p>There is another approach to this, which is not exactly writing less code but delivering less code. Let’s say you work on an eCommerce, it’s very likely that you won’t need your JS code for the checkout in your item details page, or code for the search/filtering in your home page. It’s a technique that Katie Hempenius mentions in <a href="https://vimeo.com/254858694">her talk on Smashing Conf (London 2018)</a> that might be easy for you to implement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fSvACviyDuclgpBEPALhCg.jpeg" /><figcaption><a href="https://twitter.com/andrestaltz/status/958463667422539777">A tweet from @andrestaltz</a></figcaption></figure><p>But of course that the “no code no bug” is a benefit earned by writing less code. It’s less things your team need to care about. This code might also be dead code, so the user is downloading it to never use it, and a new joiner might think that it’s not dead, try to use it and won’t understand why it’s not working properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZCYacmUpfQ1YCx-3akZOHQ.png" /><figcaption><a href="https://twitter.com/ohhoe/status/921105811849535488">A tweet from @ohhoe</a></figcaption></figure><p>If you want to check how many code is being delivered but not used, try Chrome &gt; More Tools &gt; Coverage.</p><h3>Grid Layout</h3><p>(and flexbox as well)</p><p>If you’ve already been introduced to Grid Layout (I recommend you <a href="https://cssgrid.io/">cssgrid.io</a>) you already know that you can throw away any grid framework and use native solutions. Therefore the rule <em>writing less code by leveraging native</em> can be applied to CSS as well.</p><p>The golden rule for deciding to use display grid or flex is, if you need to layout the elements in 1 dimension, you can use flexbox, if you need to control the elements in 2 dimensions then better use grid.</p><p>Of course it’s deeper than that but you can start by asking yourself this. Also, they are not self-excluded, you can combine both types of displays, and it’s incredible <a href="http://labs.jensimmons.com/">what you can do</a> <a href="https://gridbyexample.com/">with them</a>.</p><p>Grid/flexbox can replace CSS frameworks but it can also replace some JS code, for example <a href="https://foundation.zurb.com/sites/docs/equalizer.html">Foundation equalizer,</a> (or any <a href="https://css-tricks.com/snippets/jquery/equalize-heights-of-divs/">equalizer script</a>), and <a href="https://masonry.desandro.com/">Masonry</a>. <a href="https://twitter.com/rachelandrew/status/912694518574665728">I Know</a> <a href="https://rachelandrew.co.uk/archives/2017/01/18/css-grid-one-layout-method-not-the-only-layout-method/">Grid layout is not a replacement for Masonry,</a> but I’ve seen some websites using masonry and I’m pretty sure that they could be using grid instead.</p><p>What about support? Well, you can work on <a href="https://rachelandrew.co.uk/css/cheatsheets/grid-fallbacks">some fallback strategy,</a> but if your big enemy is Internet Explorer, you can have the basics working fine with some prefixes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BUIxPmUl3oc3w4U8w_TTBg.png" /><figcaption><a href="https://msdn.microsoft.com/en-us/library/hh673533(v=vs.85).aspx">Grid layout for IE10 and IE11</a></figcaption></figure><p>So far this is working quite well for me. I’ve used SASS to have some mixins and get my life easier</p><pre>@mixin grid {</pre><pre>    display: -ms-grid;</pre><pre>    display: grid;</pre><pre>}</pre><pre>@mixin grid-template-columns($value) {</pre><pre>    -ms-grid-columns: $value;</pre><pre>    grid-template-columns: $value;</pre><pre>}</pre><pre>@mixin grid-template-rows($value) {</pre><pre>    -ms-grid-rows: $value;</pre><pre>    grid-template-rows: $value;</pre><pre>}</pre><pre>@mixin grid-column($value, $span: null) {</pre><pre>    -ms-grid-column: $value;</pre><pre>    @if ($span) {</pre><pre>        -ms-grid-column-span: $span;</pre><pre>        grid-column: #{$value} / span #{$span};</pre><pre>    } @else {</pre><pre>        grid-column: $value;</pre><pre>    }</pre><pre>}</pre><pre>@mixin grid-row($value, $span: null) {</pre><pre>    -ms-grid-row: $value;</pre><pre>    @if ($span) {</pre><pre>        -ms-grid-row-span: $span;</pre><pre>        grid-row: #{$value} / span #{$span};</pre><pre>    } @else {</pre><pre>        grid-row: $value;</pre><pre>    }<br>}</pre><pre>/**** in the elements ****/</pre><pre>.container {<br>  @include grid-template-columns(1fr 1fr 1fr);<br>}</pre><p><a href="https://github.com/sheldonled/mariaquerviajar/blob/master/src/sass/_mixins.scss">I’m currently using it in my wife’s blog</a>, if you want to check this in your device, here is the link: <a href="https://mariaquerviajar.com">https://mariaquerviajar.com</a> (Portuguese content).</p><p>Removing Javascript responsible for the layout is not only good because we’re reducing the codebase, but also because we’re executing less Javascript. Masonry and Equalizer have listeners on the window resize event. Other libs are even worse and have listeners on the window scroll. By removing such code we’re also making the interaction and flow more fluid.</p><h3>Progressive Web Apps</h3><p>Progressive Web Apps is a term used to define applications served through the web that leverage technologies brought by new browsers without loosing support for the old ones.</p><p>It’s <strong>progressive</strong> because you can progressively add new features without breaking the experience on browsers that don’t support it. It’s <strong>web</strong> because it’s served through the internet via a link, like any website. It’s <strong>app </strong>because it behaves like an app on browsers and operating systems that support it.</p><p>If you have watched more than 2 talks about PWAs you probably have seen the definition “the best of the web combined with the best of apps”, but indeed it’s a very good definition. To start with PWA the first thing you’ll need is <strong>HTTPS. </strong>This is a blocker and should be prioritized even if you’re not planning on transform you website into a PWA.</p><p>Enabling HTTPS brings several benefits beyond security, such as PWA (of course) and new browser APIs. It’s nice that those browser APIs (mentioning a few later on) are only allowed under HTTPS, because they are powerful and need to work in a more secure environment.</p><p>PWA is a set of technologies, you can choose what to implement and when. There are some talks that share some strategies like <a href="https://www.youtube.com/watch?v=KRSTpo6gqqU">From Website to Progressive Web App (GDD Europe </a>’17) or <a href="https://www.youtube.com/watch?v=_srJ7eHS3IM">Fast By Default: Modern Loading Best Practices (Chrome Dev Summit 2017)</a>.</p><p>If you want to learn more about PWA, there’s a free <a href="https://eu.udacity.com/course/intro-to-progressive-web-apps--ud811">introduction course on Udacity</a> but the feature I want to mention in this post is <a href="https://developers.google.com/web/fundamentals/primers/service-workers/">Service Worker</a>. Service Worker is basically a programmable network API that gives you power to control the requests on your app. It runs on background and is the bridge between the browser and the network.</p><p>With Service Worker you not only have a much better cache strategy, but also a much more reliable experience, that improves both the perceived performance and the actual performance.</p><h4>The time has come to put FIRE on your old code</h4><p>Having so many new things makes us feel like we need to put FIRE on our codebase and start everything from the scratch, doesn’t it? Well, there’s no need for that, we can progressively enhance our app like everything on the web. But the intention on using the word FIRE (and in upper case) is that PWAs use this other acronym to dictate how the experience should be:</p><p><strong>Fast</strong>: Here comes <a href="https://twitter.com/smashingmag/status/964053039362473984">all the performance techniques to mitigate the friction between network and your app</a></p><p><strong>Integrated</strong>: By adding a <a href="https://developers.google.com/web/fundamentals/web-app-manifest/">Web App Manifest</a> you can have your web app behaving like an installed app.</p><p><strong>Reliable</strong>: By exploring all the power of <a href="https://developers.google.com/web/fundamentals/primers/service-workers/">Service Worker,</a> managing cache, slow connections and network errors.</p><p><strong>Engaging</strong>: By having push notifications you can lead the user back to your app.</p><h3>HTTPS</h3><p><a href="https://security.googleblog.com/2018/02/a-secure-web-is-here-to-stay.html">By enabling HTTPS you’re not only providing a more secure experience</a>, but you can also enable several APIs that are in the browser, starting by PWA, and to name a few others:</p><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Geolocation">Geolocation API</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API">Media Capture and Streams API</a> (<a href="https://developers.google.com/web/fundamentals/media/video">access to user’s audio visual input</a>)</li><li><a href="https://developers.google.com/web/fundamentals/media/eme">Encrypted Media Extensions</a></li><li><a href="https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web">Bluetooth API</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API">Clipboard API</a></li><li><a href="https://developers.google.com/web/ilt/pwa/introduction-to-push-notifications">Push Notifications</a></li><li><a href="https://paymentrequest.show/">Payment API</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Credential_Management_API">Credentials API</a></li></ul><h3>Conclusion</h3><p>I hope that this post has extended your vision on web performance beyond the well known barrier app vs network, and that this help you to rethink or improve your app architecture. Here’s this post checklist:</p><ul><li><a href="https://twitter.com/smashingmag/status/964053039362473984">Do all the homework to improve your Front-end performance;</a></li><li><em>Clear the Critical Path</em>;</li><li><em>Write Less Javascript</em>: By removing dead code, replacing libraries with native JS functionality, splitting your <em>app.min.js</em> and delivering only what that specific page needs;</li><li><em>Write less CSS</em>: by refactoring old code with new CSS features and replacing frameworks by native CSS;</li><li><em>Use Service Workers</em>: to manage your cache better, to have a fallback when network is off or bad. Leverage PWA to improve your user experience;</li><li><em>Split your codebase</em>. It’s easier to read, to reason about, to maintain, and less likely to introduce bugs.</li></ul><p>It’s a daily progress. You could do like I said earlier and put fire on everything and start over, but it’s more likely to have an upgrade strategy in your team and technical improvements daily efforts.</p><p>It’s also good to have everyone in your team aligned with best practices and new technologies so they can implement them in a daily work, while developing any feature or solving any bug in your application.</p><blockquote>Improving performance is a Journey. Lots of small changes can lead to Big gains. <a href="https://www.youtube.com/watch?v=_srJ7eHS3IM">Addy Osmani</a>.</blockquote><h3>References and useful links</h3><ul><li><a href="https://viewsourceconf.org/london-2017/">ViewSource Conf — London 2017</a></li><li>Rachel Andrew on <a href="https://vimeo.com/254679499">Into the Weeds of CSS Layout</a> — (<a href="https://rachelandrew.co.uk/speaking/event/smashing-london-2018">Slides</a>)</li><li>Jake Archibald on <a href="https://vimeo.com/254947206">The Event Loop</a></li><li>Philip Roberts: <a href="https://www.youtube.com/watch?v=8aGhZQkoFbQ">What the heck is the event loop anyway?</a> | <a href="https://2014.jsconf.eu/speakers/philip-roberts-what-the-heck-is-the-event-loop-anyway.html">JSConf EU 2014</a></li><li>Paul Irish —<a href="https://www.youtube.com/watch?v=2ksXo2_Lfl0"> How Users Perceive the Speed of The Web (2015)</a></li><li>Katie Hempenius on <a href="https://vimeo.com/254858694">Improving Page Performance in Modern Web Apps</a> — (<a href="https://docs.google.com/presentation/d/1hBIb0CshY9DlM1fkxSLXVSW3Srg3CxaxAbdocI67NCQ/edit#slide=id.g32e52b1ea6_1_0">Slides</a>)</li><li>Jen Simmons —<a href="https://air.mozilla.org/jen-simmons/"> Revolutionize Your Page: Real Art Direction on the Web</a>. (ViewSource 2016)</li><li><a href="http://labs.jensimmons.com/">The Experimental Layout Lab of Jen Simmons</a></li><li><a href="https://gridbyexample.com/">https://gridbyexample.com</a></li><li><a href="https://cssgrid.io/">https://cssgrid.io</a></li><li>Rachel Andrew —<a href="https://rachelandrew.co.uk/css/cheatsheets/grid-fallbacks"> Grid “fallbacks” and overrides</a></li><li><a href="https://msdn.microsoft.com/en-us/library/hh673533(v=vs.85).aspx">MSDN — Grid layout for IE10 and IE11</a></li><li><a href="https://medium.com/javascript-scene/native-apps-are-doomed-ac397148a2c0">Eric Elliott — Native Apps are Doomed</a></li><li><a href="https://developer.mozilla.org/en-US/Apps/Progressive">Progressive Web Apps — MDN</a></li><li><a href="https://developers.google.com/web/progressive-web-apps/checklist">PWA checklist (Google developers)</a></li><li>Mariko Kosaka — <a href="https://kosamari.com/notes/Service-Worker-what-are-you">Service Worker, what are you?</a></li><li><a href="https://eu.udacity.com/course/intro-to-progressive-web-apps--ud811">Intro to Progressive Web Apps — Udacity</a></li><li><a href="https://www.youtube.com/watch?v=e6DUrH56g14">Mythbusting HTTPS (Progressive Web App Summit 2016)</a></li><li><a href="https://www.youtube.com/watch?v=KRSTpo6gqqU">From Website to Progressive Web App (GDD Europe ‘17)</a></li><li><a href="https://www.youtube.com/watch?v=_srJ7eHS3IM">Fast By Default: Modern Loading Best Practices (Chrome Dev Summit 2017)</a></li><li><a href="https://developers.google.com/web/fundamentals/payments/">Payment Request API</a></li><li><a href="https://paymentrequest.show/">PaymentRequest.show()</a></li></ul><h4>For Fun</h4><ul><li><a href="http://www.flexboxdefense.com/">http://www.flexboxdefense.com</a></li><li><a href="http://flexboxfroggy.com/">http://flexboxfroggy.com</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=873c68f385a9" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/how-web-performance-css-grid-and-pwa-are-related-873c68f385a9">How web performance, CSS Grid and PWA are related</a> was originally published in <a href="https://itnext.io">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS Units, a brief digress]]></title>
            <link>https://codeburst.io/css-units-a-brief-digress-d06e511d7303?source=rss-fe93ff323db6------2</link>
            <guid isPermaLink="false">https://medium.com/p/d06e511d7303</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Sheldon Led]]></dc:creator>
            <pubDate>Tue, 20 Jun 2017 11:34:00 GMT</pubDate>
            <atom:updated>2017-06-20T14:26:46.686Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YuzakcmBI7vlrwuWdkIeUA.jpeg" /><figcaption>CSS is awesome, via <a href="https://www.memecenter.com/fun/6091/css-is-awesome">memecenter</a></figcaption></figure><p>I was afraid of writing this because it sounds too obvious to everyone that has some experience with CSS but I thought again and as it wasn’t obvious to me at a first sight it might not be obvious to someone else out there as well. I was not sure to write it also because there are already lots of content on this subject already available, but if we start worrying about that, we’ll never write anything. Actually you can scroll down to get lots of good references on this subject, so this article can be helpful in a way or another.</p><p>My research on the topic started when I was reading <a href="http://foundation.zurb.com/">foundation</a> stylesheets and realised that <a href="http://foundation.zurb.com/sites/docs/v/5.5.3/media-queries.html">they use <em>em</em> as width unit in their media queries</a><em>. </em>I knew that <a href="https://developer.mozilla.org/en/docs/Web/CSS/length"><strong><em>em</em> is relative to the font size</strong></a> of the element, but the element I was looking at had font size of 100% (which means 100% of the parent element) and when I started going up and up, I reached the html tag, that has font size of 100%. Then I thought: <a href="https://stackoverflow.com/questions/6803016/css-100-font-size-100-of-what">100% of WHAT?!</a></p><p>I’ll not detail the explanation of the measures here because it’s already detailed in the links that I’m <em>‘attaching’</em> as references but, in summary, the root element receiving font-size: 100% and the em or rem measures are related. They all rely on an absolute length, and when it’s not explicit, it is defined by the browser.</p><p>In chrome, when you go to <a href="chrome://settings/">settings</a> &gt; show advanced settings &gt; Web content &gt; <a href="chrome://settings/fonts">Customise fonts</a>, you’ll see information about the default font-size, and this value will be the base for the relative lengths calculation. You can find the same information on Firefox by going to <a href="about:preferences">Preferences</a> &gt; <a href="about:preferences#content">Content</a>, and I’m pretty sure that this setting is easy to find in any browser so I’ll stop on these two.</p><p>Using relative measures is a good practice and you can get to this conclusion quite intuitively. When you’re reading, let’s say your kindle, and you want to change the size of the font to have a better experience, it’s easy and straightforward. The same thing should happen when you’re in your browser and want to change the size of the visual elements you’re seeing.</p><h4>Using EMs in Media Queries</h4><p>This whole discussion leads me to the beginning, where I saw Foundation using <strong>EMs</strong> in Media Queries. I indeed thought it was weird but, as <a href="https://www.smashingmagazine.com/2013/03/logical-breakpoints-responsive-design/">Smash Magazine’s Article</a> says, they react to the font size of the browser that the visitor is using. This is actually logical when you think about it. If they reacted to the font size in the CSS, you could actually disable a media query from within a media query by increasing the font size.</p><p>There are some discussions if <a href="https://nicolas-hoizey.com/2016/03/people-don-t-change-the-default-16px-font-size-in-their-browser.html">it’s really necessary/good standard to base your measurements on the browser’s default font size</a>, and what I realised is that it seems quite a good standard to follow. You can read <a href="https://zellwk.com/blog/rem-vs-em/#comment-2547145640">what people say about that</a> and take your own conclusions, but it seemed really good for me to make everything depending on this unique value (browser’s default font size) to <em>draw</em> your website.</p><h4>References</h4><ol><li>[Foundation] Media Queries: <a href="http://foundation.zurb.com/sites/docs/v/5.5.3/media-queries.html">http://foundation.zurb.com/sites/docs/v/5.5.3/media-queries.html</a></li><li>[MDN] CSS Lengths: <a href="https://developer.mozilla.org/en/docs/Web/CSS/length">https://developer.mozilla.org/en/docs/Web/CSS/length</a></li><li>[w3c] The amazing em unit and other best practices: <a href="https://www.w3.org/WAI/GL/css2em.htm">https://www.w3.org/WAI/GL/css2em.htm</a></li><li>[Stackoverflow] CSS: 100% font size — 100% of what?: <a href="https://stackoverflow.com/questions/6803016/css-100-font-size-100-of-what">https://stackoverflow.com/questions/6803016/css-100-font-size-100-of-what</a></li><li>[Zell] REM vs EM: <a href="https://zellwk.com/blog/rem-vs-em">https://zellwk.com/blog/rem-vs-em</a></li><li>[Nicolas Hoizey] People don’t change the default 16px font size in their browser: <a href="https://nicolas-hoizey.com/2016/03/people-don-t-change-the-default-16px-font-size-in-their-browser.html">https://nicolas-hoizey.com/2016/03/people-don-t-change-the-default-16px-font-size-in-their-browser.html</a></li><li>[Smash Magazine] : <a href="https://www.smashingmagazine.com/2013/03/logical-breakpoints-responsive-design/">https://www.smashingmagazine.com/2013/03/logical-breakpoints-responsive-design/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d06e511d7303" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/css-units-a-brief-digress-d06e511d7303">CSS Units, a brief digress</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[Another hamburger menu]]></title>
            <link>https://medium.com/@sheldonled/another-hamburger-menu-6ed75c1793a3?source=rss-fe93ff323db6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ed75c1793a3</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Sheldon Led]]></dc:creator>
            <pubDate>Thu, 15 Dec 2016 18:08:16 GMT</pubDate>
            <atom:updated>2016-12-15T18:36:38.332Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G5axohEJ6YGIXxoWGwVprQ.png" /><figcaption>Picture designed by me (sorry), using a random hamburger image from Google and HTML/CSS</figcaption></figure><p>A few years ago there was a fever about these web pages with a button at their top, and when you click it shows a menu in a slider effect. They were (and still are) called Hamburger Menus. Even though there are <a href="https://lmjabreu.com/post/why-and-how-to-avoid-hamburger-menus/">some articles saying you should avoid them,</a> they are still in high usage and I decided to develop one, by myself, to put it in my website later.</p><h4>The button</h4><p>First, I have to code the button. I decided to use a round, blue, fixed at the top left of the page, with a little of box-shadow button. For the symbol I used font-aweseome:</p><pre>#menu-button:before {<br>  position: relative;<br>  top: 8px;<br>  left: 12px;<br>  font-family:&#39;FontAwesome&#39;;<br>  font-size: 25px;<br>  content:&quot;\f0c9&quot;;<br>  color: white;<br>}<br>#menu-button {<br>  width: 45px;<br>  height: 45px;<br>  background-color: rgba(52, 152, 219,1.0);<br>  position: fixed;<br>  top: 10px;<br>  left: 10px;<br>  cursor: pointer;<br>  border-radius: 50%;<br>  box-shadow: 1px 1px 3px 0px rgba(0,0,0,0.3);<br>  z-index: 1;<br>}</pre><p><strong>The Menu</strong></p><p>The menu is just a div with a list. Likewise the button, you can use whatever design, here’s mine:</p><pre>#menu {<br>  width: 250px;<br>  height: 100%;<br>  position: fixed;<br>  left: -250px;<br>  top: 0;<br>  background-color: rgba(52, 73, 94,1.0);<br>  z-index: 0;<br>}<br>#menu.opened {<br>  left: 0;<br>}<br>#menu ul{<br>  padding: 0;<br>  margin: 0;<br>}<br>#menu li{<br>  list-style: none;<br>}<br>#menu a {<br>  display: block;<br>  padding: 10px 15px;<br>  color: white;<br>  border-bottom: 2px dashed white;<br>  text-decoration: none;<br>  font-weight: 600;<br>}<br>#menu a:hover {<br>  color: rgba(255,255,255,0.8);<br>  border-bottom: 2px solid rgba(255,255,255,0.8);<br>}</pre><h4>Disclaimer about usage of ID instead of classes</h4><p>I don’t believe that IDs are demons and you must avoid them to the death. Beyond this fact, I like to use IDs because it easy to manipulate the elements with them, you’ll see below.</p><h4>The effect</h4><p>I thought about a simple effect on the menu. First the button should roll down to the bottom of the menu, and the symbol would be replaced by an X. At the same time, the menu would just slide smoothly and show itself. Now I used a class, to represent this state: .opened</p><pre>#menu-button.opened:before {<br>  content:&quot;\f00d&quot;;<br>}<br>#menu-button.opened {<br>  top: 90%;<br>  left: 200px;<br>  -webkit-transform:rotate(360deg);<br>  -moz-transform:rotate(360deg);<br>  -ms-transform:rotate(360deg);<br>  -o-transform:rotate(360deg);<br>  transform:rotate(360deg);<br>}<br>#menu.opened {<br>  left: 0;<br>}</pre><p>Look at the pixels math, the button has 45px of width, the menu has 250px, so when I move the button to a left of 200px, it’s now at the edge of the menu. But for these animations work, you should add in the #menu-button and #menu the transition property, ex: trasition: all .5s linear;</p><p><strong>The behavior/action</strong></p><p>To give the button an action, I had to add an event listener and, therefore I used JavaScript. As I said before, I rather use IDs in my elements because it’s easier to manage the elements:</p><pre>document.getElementById(&quot;menu-button&quot;)<br>   .addEventListener(&quot;click&quot;,function(){<br>      this.classList.toggle(&quot;opened&quot;);<br>      document.getElementById(&quot;menu&quot;).classList.toggle(&quot;opened&quot;);<br>    });</pre><pre>//For the desk<br>document.addEventListener(&quot;keyup&quot;,function(e){<br>  if(e.keyCode == 27){<br>    document.getElementById(&quot;menu-button&quot;)<br>      .classList.toggle(&quot;opened&quot;);</pre><pre>    document.getElementById(&quot;menu&quot;)<br>      .classList.toggle(&quot;opened&quot;);<br>  }<br>});</pre><p><strong>The result</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FbBQmLr%3Fheight%3D600%26amp%3Bslug-hash%3DbBQmLr%26amp%3Bdefault-tabs%3Dcss%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FbBQmLr&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/39c76db2cad4b96d160a9383c7942072/href">https://medium.com/media/39c76db2cad4b96d160a9383c7942072/href</a></iframe><p><em>Did you like it? Please hit the heart below and share this tip with your network =)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ed75c1793a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular RSS service]]></title>
            <link>https://medium.com/@sheldonled/angular-rss-service-3a3309ed6c65?source=rss-fe93ff323db6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a3309ed6c65</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[cors]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[angularjs]]></category>
            <dc:creator><![CDATA[Sheldon Led]]></dc:creator>
            <pubDate>Tue, 29 Nov 2016 16:59:11 GMT</pubDate>
            <atom:updated>2016-11-29T17:03:42.458Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QIF6rlks-1EihgoR_lx2cg.jpeg" /><figcaption>Photo via <a href="https://unsplash.com/glennoble">Glen Noble</a> via <a href="https://visualhunt.com/photo/4879/">Visualhunt</a></figcaption></figure><p>Have you ever wanted to list blog posts in your website or webapp? I wanted to <a href="http://sheldonled.com">show my blog posts as a feed in my home page</a>, so I started looking on how I’d get this, and now that I got it, I’ll show you how I did it. I’m sure that there might be a better way to do this but I’m happy with the result I’ve got.</p><p>I’ve researched a little bit about <a href="https://tylermcginnis.com/angularjs-factory-vs-service-vs-provider-5f426cfe6b8c">Factories vs Services</a> and I didn’t come with a conclusion about which one is better, maybe when creating a bigger application it would be clear. At the moment, as <a href="https://medium.com/@sheldonled/indexeddb-angular-factory-873d2da4bfc8">my last Angular example</a> uses Factories, this one will use service.</p><p>First thing to do is getting the RSS Feed XML from the blog. Due to <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS">CORS</a> problems, I had to build a small nodeJS script to get the RSS content through my server then make it available to my AngularJS script:</p><pre>var http = require(&#39;http&#39;),<br>    url = require(&#39;url&#39;),<br>//Gets the content of an URL<br>    getContent = function(url,cb){<br>  var request = require(&#39;request&#39;);<br>  request(url, function (error, response, body) {<br>    if(error)<br>      cb(error.toString());<br>    else<br>      cb(body);<br>  });<br>},<br>//Writes something in the response<br>  write = function(response, data){</pre><pre>response.setHeader(&quot;Access-Control-Allow-Origin&quot;, &quot;*&quot;);<br>response.setHeader(&quot;Access-Control-Allow-Headers&quot;, &quot;Origin, X-Requested-With, Content-Type, Accept&quot;);<br>response.writeHead(200, {&#39;Content-Type&#39;: &#39;text/plain&#39;});<br>  response.end(data);<br>};</pre><pre>http.createServer(function (req, res) {<br>  var queryData = url.parse(req.url, true).query;<br>  if(queryData.url){<br>    getContent(queryData.url, function(data){<br>      write(res,data);<br>    });<br>  }<br>  else<br>  {<br>    write(res,&quot;Unkown request&quot;);<br>  }<br>}).listen(3000);</pre><p>Now that I receive the RSS feed (mostly in XML format) I can use (new DOMParser()).parseFromString(data,&quot;text/xml&quot;) and work with the content using DOM. Feeds have similar structure, and for my need I only had to get some tags (ex:items = xmlDoc.getElementsByTagName(&quot;item&quot;) ). If you see <a href="http://codepen.io/sheldonled/full/woJKaG">my codepen example</a>, it will be pretty intuitive:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FwoJKaG%3Fheight%3D600%26amp%3Bslug-hash%3DwoJKaG%26amp%3Bdefault-tabs%3Djs%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FwoJKaG&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F107946.woJKaG.small.6b8030d3-1e35-4be0-9af4-47dc7ca9ac88.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/99af7cfd6d7218c7a0bee324ea4ec065/href">https://medium.com/media/99af7cfd6d7218c7a0bee324ea4ec065/href</a></iframe><p>Medium maybe won’t show this embedded correctly so you can see it running in <a href="http://sheldonled.com">my website</a> (clicking the arrow at the homepage) or checking the <a href="http://codepen.io/sheldonled/full/woJKaG">pen directly in Codepen</a>.</p><p>I added a <em>sort</em> function in the array of blog posts because as it can download feeds of more than one site, it’s interesting to have it organized by date of publishing.</p><pre>feedItems.sort(function(a,b){<br>  return (<br>    (new Date(b.pubDate)).getTime()<br>  - (new Date(a.pubDate)).getTime());<br>});</pre><p>The only extra (and maybe unnecessary) thing that I added was a check for Medium. Medium’s RSS Feed doesn’t differentiates blog posts from comments, so I ignore ‘items’ that don’t have the tag category. To work fine you have to add tags/categories on all of your blog posts on Medium, or it will be ignored.</p><p><em>Did you enjoy it? Please leave me a feed back or just hit the heart below, I’ll be more than happy on knowing what you think about this code snippet.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a3309ed6c65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a more compatible Web]]></title>
            <link>https://medium.com/@sheldonled/building-a-more-compatible-web-e7ebb71374c3?source=rss-fe93ff323db6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7ebb71374c3</guid>
            <category><![CDATA[mozillanofgsl]]></category>
            <category><![CDATA[mozilla]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[website]]></category>
            <dc:creator><![CDATA[Sheldon Led]]></dc:creator>
            <pubDate>Fri, 18 Nov 2016 09:01:02 GMT</pubDate>
            <atom:updated>2016-11-18T09:01:02.431Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FYqWU3FR9Znro4lMdAx1ug.jpeg" /><figcaption>Photo found at <a href="http://www.retailnews.asia/multi-device-use-rise-asia/">Retail News</a></figcaption></figure><p>Have you ever accessed a website and the design (or some functionality) was broken? Maybe it is OK but then you open an specific broswer (generally some Internet Explorer, lets be honest) and then it doesn’t work? Maybe you are a developer and knows how to fix the problem but can’t contact the owner of the website. I’ve been in those situations also, and maybe this can be our solution.</p><p>Web compatibility is about making sure websites work consistently across all browsers and devices, and sometimes with a little testing and some small tweaks to their site, developers can ensure that more users can have the full experience that is desired. Thinking about it, Mozilla has launched <a href="https://webcompat.com">https://webcompat.com,</a> a website that’s an open invitation for all web users, developers and browser vendors to get involved in the web compatibility effort.</p><p>With <a href="https://chrome.google.com/webstore/detail/webcompatcom-reporter/ffnnhckjcpbbjlmgfjigknkoffakclol">Chrome</a> and <a href="https://addons.mozilla.org/en-US/firefox/addon/webcompatcom-reporter/">Firefox</a> extensions, the user can easily share an website issue with <a href="https://webcompat.com/contributors">the community,</a> so they can work on the solution and contact the site owner to suggest them the fix, or maybe it’s a browser issue, thus they will contact the browser vendor. You can also report a bug without installing any plugin, just visiting the <a href="https://webcompat.com/?open=1">WebCompat website</a>.</p><p>With Web Compat, you can contribute in three ways: <a href="https://webcompat.com/?open=1">Reporting a Bug,</a> <a href="https://webcompat.com/issues?stage=needsdiagnosis">Diagnosing a bug</a>, <a href="https://webcompat.com/issues?stage=contactready">Reaching the site owner/developer</a>. There’s another way that’s <a href="https://github.com/webcompat/webcompat.com/blob/master/CONTRIBUTING.md">contributing with the Web Compat site</a> itself, contributions are always welcome.</p><p>If you want to <a href="https://webcompat.com/about">know more</a>, <a href="https://twitter.com/webcompat">Follow WebCompat on twitter,</a> <a href="https://webcompat.com/login">login on the website,</a> send a message to the <a href="https://webcompat.com/humans.txt">WebCompat team</a>. If you can attend, Mozilla Brazil will be on <a href="http://2016.fgsl.net">FGSL</a> in November 19th, and there you can get some real experience with this and other Mozilla projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Ui8KcX1N0zNiONHmK3pw-g.png" /><figcaption><a href="http://2016.fgsl.net">http://2016.fgsl.net</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7ebb71374c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Help build Firefox with Test Pilot]]></title>
            <link>https://medium.com/@sheldonled/help-build-firefox-with-test-pilot-267a3f54c244?source=rss-fe93ff323db6------2</link>
            <guid isPermaLink="false">https://medium.com/p/267a3f54c244</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[mozillanofgsl]]></category>
            <category><![CDATA[firefox]]></category>
            <category><![CDATA[community]]></category>
            <category><![CDATA[mozilla]]></category>
            <dc:creator><![CDATA[Sheldon Led]]></dc:creator>
            <pubDate>Thu, 17 Nov 2016 21:01:01 GMT</pubDate>
            <atom:updated>2016-11-17T21:01:01.229Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Jirsy2AFZ3OyWSx4jqjCg.png" /><figcaption><a href="https://testpilot.firefox.com/">Firefox Test Pilot</a></figcaption></figure><p>Before Firefox release any new features in the browser, they release them in an extension called <a href="https://testpilot.firefox.com/">Test Pilot</a> so we can test out and give the engineers and creators some feedback. In other words you can actually help build Firefox, by giving your opinion on new features.</p><p>Mozilla believes in an open and accessible Internet for all, always committed with privacy, user choice and Open Source Development. This ideas makes Firefox the top browser available today. But it’s difficult to get users feedback giving this <a href="https://www.mozilla.org/about/manifesto/">commitment with privacy,</a> so that’s why they made <a href="https://testpilot.firefox.com/">Test Pilot</a>.</p><p>With <a href="https://testpilot.firefox.com/">Test Pilot</a> you can choose which new feature you’ll want to test, you can read about the data they collect for each experiment and tell them what you think. Test Pilot is more than just a web app to test new things. It’s a <em>research, design, and development process</em> aimed at making feature development a smoother and more transparent process.</p><p>This process consists of <a href="https://testpilot.firefox.com/about">four phases</a>. In phase one the Test Pilot team prototype and validate the ideas. In phase two they design and build the experiment. Phase three is the launching of the experiment, it’s when we get into the game. Mozilla then monitor the stats and listen to our feedback, to shape the feature so it can be perfect. At the moment Test Pilot have these experiments:</p><ul><li><a href="https://testpilot.firefox.com/experiments/page-shot">Page Shot</a>: Lets you take screenshots (of the page, only) cut it and share it.</li><li><a href="https://testpilot.firefox.com/experiments/min-vid">Min Vid</a>: Enables a small view of the video you’re watching so you can use Internet while watching your video at the same time.</li><li><a href="https://testpilot.firefox.com/experiments/tracking-protection">Tracking Protection</a>: Kind of private navigation without using a private window.</li><li><a href="https://testpilot.firefox.com/experiments/activity-stream">Activity Stream</a>: It shows your recent activity, highlights and top sites based in your history and favorites every time you open a new tab.</li><li><a href="https://testpilot.firefox.com/experiments/tab-center">Tab Center</a>: Groups your open tabs in the left part of the browser.</li><li><a href="https://testpilot.firefox.com/experiments/no-more-404s">No More 404s</a>: Try to show an old version of a link whenever it gets ‘Page not Found’.</li><li><a href="https://testpilot.firefox.com/experiments/universal-search">Universal Search</a>: Just type a few characters in the Browser bar, and the most popular sites, people and Wikipedia articles will appear for you.</li></ul><p>Want to know more? Some members of Mozilla Brazil will be at <a href="http://2016.fgsl.net">FGSL</a> and they will show you how to be more involved. If you can’t attend, check <a href="https://twitter.com/FxTestPilot">Test Pilot on twitter,</a> <a href="https://github.com/mozilla/testpilot">Test Pilot on Github</a> and <a href="https://discourse.mozilla-community.org/c/test-pilot">Test Pilot on Discourse</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Ui8KcX1N0zNiONHmK3pw-g.png" /><figcaption><a href="http://2016.fgsl.net">Firefox Banner</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=267a3f54c244" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IndexedDB Angular Factory]]></title>
            <link>https://medium.com/@sheldonled/indexeddb-angular-factory-873d2da4bfc8?source=rss-fe93ff323db6------2</link>
            <guid isPermaLink="false">https://medium.com/p/873d2da4bfc8</guid>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[angularjs]]></category>
            <dc:creator><![CDATA[Sheldon Led]]></dc:creator>
            <pubDate>Wed, 16 Nov 2016 20:15:31 GMT</pubDate>
            <atom:updated>2016-11-16T20:15:31.229Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RjXHgPDTr1vcv5DHfAM0Cw.jpeg" /><figcaption>Photo via <a href="https://visualhunt.com/photo/67793">visualhunt</a></figcaption></figure><p>In early 2014 I heard about this thing called <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">IndexedDB</a>. As soon as I heard about it, I started to try it out while learning about it on <a href="https://developer.mozilla.org">MDN</a>. It was one of the firsts subjects that I studied on MDN, when <a href="https://medium.com/@sheldonled/volunteering-with-mozilla-20737756d439">I was discovering it</a>, and I get to translate one big article about <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB">Using IndexedDB</a> to <a href="https://developer.mozilla.org/pt-BR/docs/IndexedDB/Usando_IndexedDB">Portuguese</a>.</p><p>But this article isn’t actually about localizing articles, it is about building a Factory (do you know AngularJS Factories?) that can perform a CRUD (Create, Read, Update, Delete) using IndexedDB.</p><h4>Why Factory?</h4><p>I’ll not enter into the discussion about the <a href="http://blog.thoughtram.io/angular/2015/07/07/service-vs-factory-once-and-for-all.html">differences between Factory and Service</a> because there are tons of articles about it over the Internet. I chose Factory because I developed the feature the simplest way I could, therefore it’s not too abstract. It’s designed do work with one database only and one object store only.</p><h4>Understanding IndexedDB</h4><p>Again, for further information you should read some content like <a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API">MDN’s about IndexedDB</a> to know better. But basically IndexedDB is a low-level API for client-side storage using indexes to enable high performance searches of this data. The data is stored in your browser quite similar to cookies. If you compare to a Relational database, it will be something like:</p><ul><li>Database — Database</li><li>Table — Object Stores</li><li>Records — Objects</li></ul><p>The steps you should keep in mind are:</p><ol><li>Open a database;</li><li>Create (if don’t exist) an object store in the database;</li><li>Start a transaction to perform some operation;</li><li>Wait the transaction by using some event listeners;</li><li>do something with the results;</li></ol><p>With that in mind, I developed the factory using a little more than 100 lines to perform the basic operations. The example is shown at the <a href="http://codepen.io/sheldonled/pen/qqaomO">pen below</a>:</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fpen%2FqqaomO&amp;src=https%3A%2F%2Fcodepen.io%2Fsheldonled%2Fembed%2Fpreview%2FqqaomO%3Fheight%3D600%26amp%3Bslug-hash%3DqqaomO%26amp%3Bdefault-tabs%3Djs%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/4403d2f89dd3865113e0ad108297a67a/href">https://medium.com/media/4403d2f89dd3865113e0ad108297a67a/href</a></iframe><p>Of course you can improve this Factory in million ways, this is just a bootstrap. IndexedDB is great when it comes to <a href="http://offlinefirst.org/">Offline First Applications</a> and you should give it a try. I hope that this code helps you coding your apps.</p><p><em>Did you like it? Please hit the heart below or leave a comment. I can’t wait for your feedback.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=873d2da4bfc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>