<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xmlns:tt="http://teletype.in/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>The Front End</title><generator>teletype.in</generator><description><![CDATA[The Front End]]></description><image><url>https://teletype.in/files/4c/4c611a93-5050-4d48-931e-a43424b5422e.jpg</url><title>The Front End</title><link>https://teletype.in/@thefrontend</link></image><link>https://teletype.in/@thefrontend?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend</link><atom:link rel="self" type="application/rss+xml" href="https://teletype.in/rss/thefrontend?offset=0"></atom:link><atom:link rel="next" type="application/rss+xml" href="https://teletype.in/rss/thefrontend?offset=10"></atom:link><atom:link rel="search" type="application/opensearchdescription+xml" title="Teletype" href="https://teletype.in/opensearch.xml"></atom:link><pubDate>Thu, 14 May 2026 02:05:10 GMT</pubDate><lastBuildDate>Thu, 14 May 2026 02:05:10 GMT</lastBuildDate><item><guid isPermaLink="true">https://teletype.in/@thefrontend/A4s4PBh_H</guid><link>https://teletype.in/@thefrontend/A4s4PBh_H?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend</link><comments>https://teletype.in/@thefrontend/A4s4PBh_H?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend#comments</comments><dc:creator>thefrontend</dc:creator><title>Scrolling. You thought its trivial.</title><pubDate>Tue, 12 May 2020 20:36:43 GMT</pubDate><media:content medium="image" url="https://teletype.in/files/28/83/2883cb42-fc15-482d-a9de-7d8f0d5dedc0.png"></media:content><description><![CDATA[<img src="https://teletype.in/files/24/fe/24fec6cf-a67a-4d0d-a5d5-768697cb668c.jpeg"></img>Well maybe it is. But not in our case. Let me explain.]]></description><content:encoded><![CDATA[
  <p>Well maybe it is. But not in our case. Let me explain.</p>
  <figure class="m_original">
    <img src="https://teletype.in/files/24/fe/24fec6cf-a67a-4d0d-a5d5-768697cb668c.jpeg" width="702" />
  </figure>
  <p>Let&#x27;s just say I have a React app. And let&#x27;s just imagine for a second that all I want to do is make a page scroll &amp; filter something on a page. Should be easy right?<br /></p>
  <h3><br />A bit more context.</h3>
  <p>Suppose what I have is a page of multiple &#x27;Cards&#x27;. Now, each card is a completely isolated component. By &#x27;isolated&#x27; here we mean it is fully independent. So it loads on its own, has some unique API in it that it uses to retrieve data with say <a href="https://www.npmjs.com/package/axios" target="_blank">axios.</a> Let&#x27;s even say we get some nice <a href="https://ant.design/components/skeleton/" target="_blank">skeleton</a> on loading.</p>
  <p>Point being, those &#x27;cards&#x27; are completely decoupled from the main page and work on its own that encourages reusability and make our life easier in the future (and well, something that is <a href="https://reactjs.org/docs/thinking-in-react.html" target="_blank">motivated by React</a> itself).</p>
  <figure class="m_column">
    <img src="https://teletype.in/files/26/61/2661da8a-f488-4d59-ac5f-35efe28b2a87.png" width="1220" />
  </figure>
  <p>Now, what we want to achieve is click on a button in top right card and <strong>scroll</strong> to the bottom card as well as <strong>filter</strong> it somehow. For example, you might have <a href="https://codesandbox.io/s/2v7lk" target="_blank">several tabs in the bottom component</a> and what you want is to do 2 main simple things:<br /></p>
  <ol>
    <li>Scroll to this guy</li>
    <li>Filter it to the 2nd tab</li>
  </ol>
  <p>Sounds so simple that you might be wondering &quot;Whats it all about??&quot;.</p>
  <h3>Well, let&#x27;s just think how this practically can be done in general?</h3>
  <ul>
    <li>Take <code>myCoolCard.jsx</code> and handle onClick event that would send a callback to <code>index.jsx</code>. And then in <code>index.jsx</code> we grab <code>scrollAndFilter.jsx</code> with <code>createRef() </code> <a href="https://reactjs.org/docs/refs-and-the-dom.html" target="_blank">(learn more)</a> scroll to it with something like <code>window.scrollTo(0, this.myRef.current.offsetTop)</code> as well as pass a new prop to it e.g. Tab=&#x27;2&#x27;.</li>
  </ul>
  <p>Do we like it? Well, it would do the job. But sending data from a <strong>child</strong> (myCoolCard.jsx) to a <strong>parent</strong> (index.jsx) via callbacks is something that soon enough will end up in a massive unreadable codebase + it gets really dependant on the parent. What if you want to reuse myCoolCard.jsx in a similar way somewhere else in the app. You will have to completely repeat you logic (like we never heard of <a href="https://en.wikipedia.org/wiki/Don%2527t_repeat_yourself" target="_blank">DRY</a>). </p>
  <ul>
    <li>Another way is to throw in Redux and instead of a callback save data onClick (Tab=&#x27;2&#x27;) in the store. And then get all components including parent accessing it and adjusting logic based on this (e.g. listening to it and filtering/scrolling accordingly). But personally, it is quite debatable whether this kind of data should be ever saved in Redux store. Its just too.. well, exclusive. Still thats better than callbacks. </li>
  </ul>
  <h3>Let me just cut it short as it already sounds like we are overkilling something here. </h3>
  <p>We could update the url and get scrollAndFilter.jsx listen to it to scroll &amp; filter itself. <br />Oh wait, there it is, doesn&#x27;t <a href="https://reacttraining.com/react-router/web/guides/quick-start" target="_blank">React Router</a> solves it already? <br /><br />Should do, so we could just use something like <code>&lt;Link to=&quot;index#about&quot;&gt;Home&lt;/Link&gt;</code><br />and just scroll to the hash (#about or in our case scrollAndFilter) - awesome! 🔥</p>
  <p>..Would be if it worked 🤷‍♂️. You see, there is an <a href="https://github.com/ReactTraining/react-router/issues/394#issuecomment-220221604" target="_blank">issue with React-router</a> that wouldn&#x27;t let you do it, so you will have to install <a href="https://github.com/rafrex/react-router-hash-link/tree/react-router-v2/3" target="_blank">separate package</a> which is based on custom &lt;Link&gt; component (meh 😄), which could be a solution, but we have <a href="https://bundlephobia.com/" target="_blank">bundlephobia</a> and don&#x27;t want to add extra stuff that we don&#x27;t really need. Otherwise, we would use <a href="https://www.npmjs.com/package/react-scroll-to" target="_blank">react-scroll-to</a> in the first place.</p>
  <figure class="m_column">
    <img src="https://teletype.in/files/4c/0c/4c0c00d3-6472-4a01-a48a-54ecf2b0c730.jpeg" width="490" />
  </figure>
  <p>And then we scratch head, break things and come up with a <strong>weird solution</strong> that works perfectly for our case. We don&#x27;t install any extra stuff and just do it with react-router (that is something everyone use in React anyway right 😅?)</p>
  <p>What we do is we pass state with &lt;Link component&gt; and set up a hash with it. The only difference the hash for us is just to make things more consistent, we don&#x27;t use it for scrolling. <br /><br />So, <br /><br />somewhere in <strong>myCoolCard.jsx</strong></p>
  <pre>&lt;Link to={{ hash: &#x27;filter&#x27;, state: { tab: &#x27; 2&#x27; } }}&gt;click here&lt;/Link&gt;</pre>
  <p>this would do 2 things: pass <code>tab: &#x27; 2&#x27;</code> to this.props.location.state and append url with <code>#filter</code></p>
  <p>somewhere in <strong>scrollAndFilter.jsx</strong></p>
  <pre>componentWillReceiveProps(nextProps) {
    if (nextProps.location.state &amp;&amp; this.state.tab !== nextProps.location.state.tab) {
      if (nextProps.location.hash === &#x27;#filter&#x27;) {
        this.setState({ tab: nextProps.location.state.tab.trim() });
        this.filterCardRef.current &amp;&amp; this.filterCardRef.current.scrollIntoView({ behavior: &#x27;smooth&#x27; });
        this.props.history.push({ hash: &#x27;&#x27; });
      }
    }
  }</pre>
  <p>Wait wait, I know. Let me explain. </p>
  <p>What happens is we actually completely ignoring the parent. We don&#x27;t even touch index.jsx here. Everything happens in the other 2 cards. First we just send state and hash from &lt;Link&gt; and then we listen in the other component for anything new to come in, we exclude it to only stuff that has <code>tab</code> and <code>hash</code> so anything else wouldn&#x27;t trigger scrolling.</p>
  <p>We also trim the incoming tab state so that we can scroll back click again and get automatically scrolled again (even though its already filtered to tab &#x27;2&#x27;). And also we clear hash so it works in the future link clicks without any bugs. </p>
  <p><code>.scrollIntoView({ behavior: &#x27;smooth&#x27; })</code> is something you attach to your ref so that it can be scrolled to easily and smoothly. </p>
  <p>And that&#x27;s actually it. </p>
  <p>The same logic can be applied to any other cards completely isolated from the parent. In fact, you can take those 2 cards throw them into a different page and that would still work.</p>
  <h3>If anything is unclear join <a href="https://t.me/s/thefrontend" target="_blank">https://t.me/s/thefrontend</a></h3>
  <p>Not that it is gonna make things clearer, but hey - why not? 😂</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@thefrontend/BJTGU0XK7</guid><link>https://teletype.in/@thefrontend/BJTGU0XK7?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend</link><comments>https://teletype.in/@thefrontend/BJTGU0XK7?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend#comments</comments><dc:creator>thefrontend</dc:creator><title>Paying for online courses: Good or Bad</title><pubDate>Sat, 22 Sep 2018 14:47:49 GMT</pubDate><media:content medium="image" url="https://teletype.in/files/a5/a5619f86-8b5a-4fc5-bab4-d0a1d7167e69.png"></media:content><description><![CDATA[<img src="https://teletype.in/files/69/69dc1ce3-2fed-4400-a80a-1fd19235f362.jpeg"></img>Let's get right to the point: how often you think &quot;ah, paying 15$ for udemy or coursera course is not worth it&quot;?]]></description><content:encoded><![CDATA[
  <figure class="m_custom">
    <img src="https://teletype.in/files/69/69dc1ce3-2fed-4400-a80a-1fd19235f362.jpeg" width="1366" />
  </figure>
  <p>Let&#x27;s get right to the point: how often you think &quot;ah, paying 15$ for udemy or coursera course is not worth it&quot;?</p>
  <p>Of course, because you can find everything for free, right?</p>
  <p>Take a step back and consider something known as <strong>perceived value of digital/physical goods. </strong>The reason physical books for example are still alive is because people treat them as an extension of themselves, whereas online course in Java can be treated as something less important and valuable.</p>
  <p>The reality, however, is that you should count the value it brings and the time you spent enjoying the purchase. The average lunch in London can be approx. 8$ (coffee, sandwich and a cookie), you enjoy it for abstractly 40 min and then leave the cafe (money spent, value received).</p>
  <p>Time in this instance (as well as in our whole life) is the only limited resource we should really care about. Time is strongly linked to happiness as with this finite resource you can choose whether to spend time with the important ones, make money, read a book, watch a film, do laundry etc. It is the one and only thing we have in our lives and if we value it properly, it can make us better and happier as a result.</p>
  <h2>Now back to online courses.</h2>
  <p>While I was learning coding, I have gone through tons of material online, normally thinking that I can always find a free alternative and make the most out of it. However there is a trick that I didn&#x27;t know about at that time.</p>
  <p><strong>The free stuff is free, just because there is a better paid version</strong></p>
  <p><em>(read it one more time)</em></p>
  <p>Most of the free programming courses that I found useful linked me to a more detailed paid ones and while it was fine to grasp the basics, when I wanted more - it always required me to pay. It is understandable though, a professional developer invest their time and effort, share tips and their experience and does expect to get a penny back. And we all want to learn from the best, right?</p>
  <p>This is just how it works.</p>
  <p>Google <strong>Taylor&#x27;s motivation theory</strong> - he proved that the main incentive for people is actually money (and not perks, benefits, recognition - although that also counts).</p>
  <p>Which is why it is not unfair, ugly or bad when someone wants to get paid for what they do, it is unfortunately how our world works🤷🏻‍♂️</p>
  <p>With online courses it is also the fact that the guys combine and filter all the informational rubbish that wouldn&#x27;t get you anywhere, add their own unique experience on top - and there we have a perfect recipe for good course. The logic is dead simple - you can spend 10 hours filtering, testing and finding the good content yourself or pay for a highly ranked course online and get it all right away. As a result, 10 hours saved, which you can actually use to make something with the new skills you learnt and make money (often more than you spent on the course).</p>
  <p>☝🏻Finally, my personal statistics show that I am more likely to finish the course that I paid for than the one I got for free. We tend to value money that we spend and want to get the most out of it.</p>
  <p><strong>So what are you waiting for?</strong> Stop complaining about unfair, money-focused world, go get yourself a course for a few bucks in Neural Networks, AI, Blockchain, Mobile development and learn something that can actually make you rich and let you enjoy your time more efficiently 👊🏻. Good luck!</p>
  <p>Agree? Join <a href="http://t.me/thefrontend" target="_blank">@thefrontend </a></p>
  <p>(might even get a few dev courses for free, who knows 😀)</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@thefrontend/rJLEd5SvQ</guid><link>https://teletype.in/@thefrontend/rJLEd5SvQ?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend</link><comments>https://teletype.in/@thefrontend/rJLEd5SvQ?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend#comments</comments><dc:creator>thefrontend</dc:creator><title>PWA vs INSTANT APPS</title><pubDate>Thu, 30 Aug 2018 18:46:04 GMT</pubDate><media:content medium="image" url="https://teletype.in/files/a6/a63a1760-7c29-41ba-8b93-23377c81a687.jpeg"></media:content><description><![CDATA[<img src="https://teletype.in/files/bf/bf6fd3b0-72e8-4d6f-a14f-3a70ce98f68b.jpeg"></img>Since many of you wanted to know more about the specifics on PWA and INSTANT APPS, here is a quick review on the two, we will look at the 3 basic componential parts.]]></description><content:encoded><![CDATA[
  <figure class="m_custom">
    <img src="https://teletype.in/files/bf/bf6fd3b0-72e8-4d6f-a14f-3a70ce98f68b.jpeg" width="1200" />
  </figure>
  <p>Since many of you wanted to know more about the specifics on PWA and INSTANT APPS, here is a quick review on the two, we will look at the 3 basic componential parts.</p>
  <ul>
    <li>Speed</li>
    <li>Build complexity</li>
    <li>Branding</li>
  </ul>
  <p>But first it makes sense to do a bit of googling and wikipedying.</p>
  <h2>First PWA, what is it and why does everyone talks about it?</h2>
  <figure class="m_column">
    <img src="https://teletype.in/files/68/6819833f-d6c0-4818-9f18-810a20f0b288.jpeg" width="804" />
  </figure>
  <p>Google as usual is the one standing behind popularising this concept. While you will see a lot of bold words like: <a href="https://developers.google.com/web/progressive-web-apps/" target="_blank"><strong>fast</strong>, <strong>reliable</strong>, <strong>engaging</strong></a>. Esseintially it is a web app built with typical tools like HTML, CSS, JS and that has a nice caveat around it that can utilise something like <strong>service workers</strong> that stay in between your web app and the server. This allows PWA to have something that normal web sites won&#x27;t provide - ability to work offline.</p>
  <p>You can easily try telegram, instagram, facebook as web apps and pin them to your mobile home page. So in short, it will provide you the typical app&#x27;s functionality and will work fine.</p>
  <p>Don&#x27;t confuse it with responsiveness though. While it does inteconnect, your Bootstrapped web site will not be considered as PWA just because it adapts to your user&#x27;s screen. It will simply be a responsive site.</p>
  <p>There is only 1 problem with this: since it is not an app, it is hard to get to phone&#x27;s functionality like Bluetooth, Flashlight etc.</p>
  <h2>Then what the hell is Android Instant Apps (AIA) and why not use normal apps?</h2>
  <figure class="m_custom">
    <img src="https://www.pagelizard.com/wp-content/uploads/2016/07/Android-Instant-Apps-infographic.jpg" width="818" />
  </figure>
  <p>The AIA is in short is a real app the has access to all your phone functionalities. At some point Google realised that people are sick from dowloading stuff from App Stores and thought on how to make it usable without downloading software to your phone. The picture above nicely represent the concept and main difference from the typical apps you see. It is frankly just a lighter version of an app.</p>
  <p>If you have a news app, you can create a lighter component of the app and Google will catch it automatically, show it in the search, but instead of linking it to the Google Play, it will load a lighter component directly in the browser and you can use the app.</p>
  <h2>Now the fun part.</h2>
  <p><strong>Speed</strong></p>
  <p>Let&#x27;s try to find a random AIA and PWA to compare. For the last there is a nice website that has a list of PWAs - <a href="https://pwa.rocks" target="_blank">https://pwa.rocks</a>. And for the AIA - anything that Google retrieves can work.</p>
  <p>PWA Financial Times.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/91/914ca5eb-83df-4946-b0d5-5b89eac27f63.jpeg" width="360" />
  </figure>
  <p>It will open in a perfectly responsive form, suggesting to add this web app to the home page (nice addition as you can later launch it from home). Loads pretty fast, the drawbacks are the search bar (which does dissapear if you launch from home screen) and the fact that it is not an app - you can feel that your experince is not as smooth as the typical app will provide.</p>
  <p>However it does the job, loads very quickly and some other examples (e.g. telegram) can work offline - will take your message and send it as soon as there is an internet connection, which is similar to the app.</p>
  <p>Taking <a href="https://meduza.io" target="_blank">meduza.io</a> news website as an alternative.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/5e/5eea45b1-361d-41ef-a345-e2f2d4a91fe5.jpeg" width="360" />
  </figure>
  <p>It actually does offer both PWA and AIA. When checking it out we can see that the main page loads without significant differences for both. However if you open meduza.io for the first time - you will notice that the AIA starts downloading something (which looses in the speed battle) - that is that ligher app&#x27;s component that can be used in the browser.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/77/77d45b83-a42f-4869-9013-c1d63bc25bcc.jpeg" width="360" />
  </figure>
  <p>The good part is that in the further launches it will be instant and will outperform PWA.</p>
  <p>Meduza AIA:</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/80/80efd1bc-3783-4aad-863b-540d1fb2ad14.jpeg" width="360" />
  </figure>
  <p>The AIA will even create an &#x27;instant app&#x27; that you can launch in the future right away:</p>
  <figure class="m_column">
    <img src="https://teletype.in/files/7b/7b9c3b4f-5a57-4d8f-ba50-dc69de7e21d9.jpeg" width="1280" />
  </figure>
  <p>But news web sites are something simple to compare - let&#x27;s dive deeper.</p>
  <p>Take a financial manager tracker or a messenger as an example. The PWA will launch fine, will work offline, can be added to the home screen <strong>BUT </strong>you will definetly say that it is not an app. The speed, animations will be like what you see in the web.</p>
  <p>The messenger&#x27;s AIA will be different. But the question is - does it actually exist? Which part of the messenger can be considered light? Shall we remove ability to record audio or send stickers? That is the main AIA&#x27;s problem - it is unlikely to even challenge this problem and only cope with news apps, info apps, online shops where PWA can do it all (unless you need to access a flashlight in your app).</p>
  <p><strong>Build Complexity</strong></p>
  <p>This one is tricky. On one hand, to build a proper PWA you will have to first make a responsive web site, differentiate between all devices (tablets, phones), allign your components so that it can be seen nicely on all devices. Add to those the fact that you have to add service workers (and learn how to use them) - and building PWA doesn&#x27;t look like a 3 min deal anymore.</p>
  <p>AIA subjectively is easier. You are building an app anyway and just by specifying in the app which component to load (e.g. only news retrieval) - you can hit two birds with one stone. But you also should remember that AIA is not as popular and iOS users won&#x27;t be able to use it <a href="https://www.quora.com/Will-there-be-instant-apps-for-iOS" target="_blank">yet</a>.</p>
  <p>So while AIA does offer a nice, more native experience, you can simply loose iPhone users because of this and well people also won&#x27;t use your instant app on PCs for obvious reasons.</p>
  <p><strong>Branding</strong></p>
  <p>It became too popular to shout out that we are PWA, we are modern, smart and reliable. Or also - we are AIA, which most people will think you are speaking Chinese.</p>
  <p>The reality though, is that if you are building PWA - you can be considered trendy, a huge proportion of users can start using your service without downloading uneccessary stuff.</p>
  <p>Check <a href="https://getmitty.com" target="_blank">mitty</a> as an example, it is an iOS app built in Swift, but that has a selection of PWA apps like uber, skyscanner, airbnb etc - so instead of downloading all of them you can download 1 app and have access to the rest. One could argue however, that you can also just pin uber, telegram, facebook, airbnb to your home screen and then there is no need to download apps at all.</p>
  <p>On a personal note, I have a belief that both conepts are here to stay - and those who master both PWA and AIA will rule the world. Development of full native apps will be displaced by PWA, and AIA&#x27;s responsive sites and web services like online shops will be able to compete with PWA by providing a light component of the app.</p>
  <p><strong>Finally, if you read it all the way till here, take a minute and think about this:</strong></p>
  <blockquote>Why is it mainly Google that tries to push the industry to the new standards? Why does Apple stay aside and doesn&#x27;t invest into industry&#x27;s evolution? What would happen with its App Store revenue if suddenly everyone moves to PWA?</blockquote>
  <p>Liked the article, disagree or want to discuss?</p>
  <p>Join <a href="https://t.me/thefrontend" target="_blank">@thefrontend</a> in telegram</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@thefrontend/HJ8sy9k7m</guid><link>https://teletype.in/@thefrontend/HJ8sy9k7m?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend</link><comments>https://teletype.in/@thefrontend/HJ8sy9k7m?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend#comments</comments><dc:creator>thefrontend</dc:creator><title>SASS in 15 minutes</title><pubDate>Sun, 08 Jul 2018 13:20:29 GMT</pubDate><media:content medium="image" url="https://teletype.in/files/dc/dcbfb35e-f298-4b0f-aacc-e369d3461812.png"></media:content><description><![CDATA[<img src="https://teletype.in/files/88/88c38582-7d6b-41e6-a30b-8706108cea13.jpeg"></img>If you write a lot of CSS, preprocessor like SASS can significantly ease the amount of your work and your stress levels. Things like Sass, Less, Stylus or PostCSS make your CSS files more readable and improve maintainability. Thanks to variables and functions the code will become cleaner, better structured and as a result help developers to work faster and make less errors.]]></description><content:encoded><![CDATA[
  <figure class="m_custom">
    <img src="https://teletype.in/files/88/88c38582-7d6b-41e6-a30b-8706108cea13.jpeg" width="1366" />
  </figure>
  <p>If you write a lot of CSS, preprocessor like SASS can significantly ease the amount of your work and your stress levels. Things like <a href="http://sass-lang.com/" target="_blank">Sass</a>, <a href="http://lesscss.org/" target="_blank">Less</a>, <a href="http://stylus-lang.com/" target="_blank">Stylus</a> or <a href="https://github.com/postcss/postcss" target="_blank">PostCSS</a> make your CSS files more readable and improve maintainability. Thanks to variables and functions the code will become cleaner, better structured and as a result help developers to work faster and make less errors.</p>
  <h2>Start</h2>
  <p>The browser on its own doesn&#x27;t understand Sass files, so it needs to compile them in the normal plain old CSS. Hence, we&#x27;ll need something to convert .scss files to .css. And there are several options here:</p>
  <ul>
    <li>The easiest way - is a browser converter for compilation Sass on the spot — <a href="http://www.sassmeister.com/" target="_blank">SassMeister</a>.</li>
    <li>Usage of apps: there are both paid and free ones available. Read more <a href="http://sass-lang.com/install" target="_blank">here</a>.</li>
    <li>If you a command line - lover, you can install Sass on your machine and compile it manually.</li>
  </ul>
  <p>If you choose the command line at then end - you can install Sass in its original wrapper, developed on Ruby or you can try <a href="https://github.com/sass/node-sass#command-line-interface" target="_blank">Node.js port</a>.</p>
  <p>You can compile .scss file using the command line like this:</p>
  <pre>node-sass input.scss output.css
</pre>
  <p>Also, it is now a good time to mention that Sass offers 2 different types of syntax: Sass and SCSS. Both do the same thing, but developed differently. SCSS is a bit newer and normally considered to be a better option, so we will be using that. If you want to read about the differences on the two - have a read <a href="http://thesassway.com/editorial/sass-vs-scss-which-syntax-is-better" target="_blank">here</a>.</p>
  <h2>Variables</h2>
  <p>Variables work in exactly the same way you saw in every other programming language. When declaring, we store a specific value in it, which we usually see in CSS like color, font or any other property like <code>box-shadow.</code></p>
  <p>Below are the examples of such variables in SCSS and CSS.</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/2d45b432efa3dc92d548f.png" width="2924" />
  </figure>
  <p>After compilation, the above will look like this in CSS:</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/d94b8b3c9e00956dfb29f.png" width="2580" />
  </figure>
  <p>The idea is that it can simplify the process of repetitive usage of variables and also we can quickly change the value of a specific variable where we declare it instead of surfing through your code.</p>
  <h2>Mixin</h2>
  <p><a href="http://oocss.org/spec/css-mixins.html" target="_blank">Mixin</a> can also be used as a class-constructor in the programming language: you use several properties from the CSS creating a separate object, which later can be used wherever you want assigning different values to its properties.</p>
  <p>Have a look at the example below:</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/5ba9bf63ec7cdd51d3650.png" width="2188" />
  </figure>
  <p>Thats what we will see in CSS:</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/f0cf2b66189a5cf87b22c.png" width="1584" />
  </figure>
  <p>One more way to simplify you work with mixin is to use it with prefixes for browser adaption.</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/b88b02521ca5ee7cc34e4.png" width="3400" />
  </figure>
  <p>CSS:</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/695b89384795ca27387c6.png" width="3744" />
  </figure>
  <h2>Extend</h2>
  <p>Next nuance that we will look at is <a href="https://css-tricks.com/the-extend-concept/" target="_blank">@extend</a>. It allows us to inherit CSS properties to one selector from the other one. The principle is somewhat similar to Mixin, but Extend is mostly used to create logical connection between the page elements.</p>
  <p>E.g. Extend is used when we need 2 similar elements that has slight differences. For example, let&#x27;s take 2 buttons: Confirm and Cancel.</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/8462911f50adc8be95a4f.png" width="2492" />
  </figure>
  <p>CSS:</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/0cc7c146147f8f466e693.png" width="2492" />
  </figure>
  <p>If you have a look at the CSS code, you will see that Sass combines selectors instead of repeating the same ones several times in the code.</p>
  <h2>Nested constructions</h2>
  <p>As you would know, in HTML the developer write code following the &#x27;nesting&#x27; principle. In other words, blocks of code are located in other blocks. CSS on the other hand normally looks chaotic in this sense. If that is a problem for you Sass can help you to organise and structure it.</p>
  <p>An example of code in SCSS:</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/d908d551e62572f160663.png" width="1716" />
  </figure>
  <p>And the same in CSS:</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/10fdfc747bbb1d8f935b9.png" width="1540" />
  </figure>
  <h2>Operations</h2>
  <p>You can do different mathematical operations right inside the code, which massively improve the workflow.</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/19a988d724fd7772df14d.png" width="1372" />
  </figure>
  <p>CSS:</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/c0690171491835a9eea7b.png" width="1152" />
  </figure>
  <p>Although right now you can do the same thing in CSS by using <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/calc" target="_blank">calc()</a>, the Sass alternative method is faster to write and has <strong>mod (%) </strong>operation and also can be used in a wider spectre of types.</p>
  <h2>Functions</h2>
  <p>Sass provide a huge list of functions. For example, functions for operations on lines, colours or different mathematical operations like <strong>random() </strong>or <strong>round().</strong></p>
  <p>To make it a bit more visual let&#x27;s have a function <strong>darken ($color, $amount), </strong>which (as you probably guessed) will darken or attach hover effect.</p>
  <p>SCSS code:</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/906ff838b569bdcdb9a85.png" width="2492" />
  </figure>
  <p>CSS:</p>
  <figure class="m_custom">
    <img src="http://telegra.ph/file/555f8ea6fc4c4f7011572.png" width="1716" />
  </figure>
  <p>In addition to a huge <a href="http://sass-lang.com/documentation/Sass/Script/Functions.html" target="_blank">list</a> of functions, you can also <a href="http://sass-lang.com/documentation/file.SASS_REFERENCE.html#function_directives" target="_blank">declare your own</a>.</p>
  <p>Some parts of the above will eventually get to the normal CSS, but till then preprocessors are a great way to make your life easier and Sass here is a very decent choice.</p>
  <p>*Translated from <a href="https://t.me/webb_dev" target="_blank">WebDev</a>.</p>
  <p>*Join <a href="https://t.me/thefrontend" target="_blank">@thefrontend</a> channel for more🔥.</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@thefrontend/rydbW96fX</guid><link>https://teletype.in/@thefrontend/rydbW96fX?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend</link><comments>https://teletype.in/@thefrontend/rydbW96fX?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend#comments</comments><dc:creator>thefrontend</dc:creator><title>Learning Material</title><pubDate>Sat, 07 Jul 2018 01:01:52 GMT</pubDate><media:content medium="image" url="https://teletype.in/files/69/69eaf195-d4ca-4cf7-8b53-ee9082e2f8d4.png"></media:content><description><![CDATA[<img src="https://camo.githubusercontent.com/29765c4a32f03bd01d44edef1cd674225e3c906b/68747470733a2f2f63646e2e7261776769742e636f6d2f66616365626f6f6b2f6372656174652d72656163742d6170702f323762343261632f73637265656e636173742e737667"></img>(the fastest and easiest way is to use their official 'out of the box' solution)]]></description><content:encoded><![CDATA[
  <h2><strong>☝🏻Setting up the environment with React</strong></h2>
  <p><em>(the fastest and easiest way is to use their official &#x27;out of the box&#x27; solution)</em></p>
  <figure class="m_custom">
    <img src="https://camo.githubusercontent.com/29765c4a32f03bd01d44edef1cd674225e3c906b/68747470733a2f2f63646e2e7261776769742e636f6d2f66616365626f6f6b2f6372656174652d72656163742d6170702f323762343261632f73637265656e636173742e737667" width="825" />
  </figure>
  <p><a href="https://github.com/facebookincubator/create-react-app#create-react-app" target="_blank">https://github.com/facebookincubator/create-react-app#create-react-app</a>-</p>
  <h2>☝🏻<strong>Thinking in React </strong></h2>
  <figure class="m_custom">
    <img src="https://reactjs.org/static/thinking-in-react-components-eb8bda25806a89ebdc838813bdfa3601-82965.png" width="275" />
  </figure>
  <p><em>(it is pretty specific on how React view development with breakdown into different components. The link also has official facebook tutorial on the right)</em></p>
  <p><a href="https://reactjs.org/docs/thinking-in-react.html" target="_blank">https://reactjs.org/docs/thinking-in-react.html</a></p>
  <h2>☝🏻<strong>Best way to structure your React dev is to split everything in Components/Containers view </strong></h2>
  <p><a href="https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0" target="_blank">https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0</a></p>
  <h2><strong>React Bootstrap </strong></h2>
  <p><em>(React&#x27;s bootstrap can slightly vary from a normal one, just to make our development a bit more.. like React style)</em></p>
  <p><a href="https://react-bootstrap.github.io/components.html#page-layout" target="_blank">https://react-bootstrap.github.io/components.html#page-layout</a></p>
  <h2>Refresh your JS knowledge</h2>
  <p><a href="https://learnxinyminutes.com/docs/javascript/" target="_blank">https://learnxinyminutes.com/docs/javascript/</a></p>
  <h2>☝🏻Firecasts</h2>
  <p><em>(the best quick videos I have seen on how firebase work with React. They have a series of videos there on Firebase+React)</em></p>
  <figure>
    <iframe src="https://www.youtube.com/embed/mwNATxfUsgI"></iframe>
  </figure>
  <p>To add on the above, this guy explain really well the authentication in React</p>
  <p><a href="https://www.robinwieruch.de/complete-firebase-authentication-react-tutorial/" target="_blank">https://www.robinwieruch.de/complete-firebase-authentication-react-tutorial/</a></p>
  <h2>More?</h2>
  <p>a few practical examples in React</p>
  <p><a href="https://tutorialzine.com/2014/07/5-practical-examples-for-learning-facebooks-react-framework" target="_blank">https://tutorialzine.com/2014/07/5-practical-examples-for-learning-facebooks-react-framework</a></p>
  <p>A lot of quality content on React with examples</p>
  <p><a href="https://reactfaq.site/" target="_blank">https://reactfaq.site/</a></p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@thefrontend/HyQyhqiCM</guid><link>https://teletype.in/@thefrontend/HyQyhqiCM?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend</link><comments>https://teletype.in/@thefrontend/HyQyhqiCM?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend#comments</comments><dc:creator>thefrontend</dc:creator><title>Cooking with JS asynchronously</title><pubDate>Fri, 18 May 2018 00:18:34 GMT</pubDate><media:content medium="image" url="https://teletype.in/files/34/34e2f482-0bfb-41d5-afc6-003ba09168ed.png"></media:content><description><![CDATA[<img src="https://teletype.in/files/9e/9efbe302-493f-4080-b81d-ebfa7850779c.jpeg"></img>If you have ever asked those questions yourself. Here is a quick recipe how to not get confused.]]></description><content:encoded><![CDATA[
  <figure class="m_custom">
    <img src="https://teletype.in/files/9e/9efbe302-493f-4080-b81d-ebfa7850779c.jpeg" width="1366" />
  </figure>
  <h2>What the hell are callbacks, why do I need to promise anything, what&#x27;s all the fuss about async/await stuff?</h2>
  <p>If you have ever asked those questions yourself. Here is a quick recipe how to not get confused.</p>
  <p>First, let&#x27;s cook some <strong>Carbonara</strong>🔥.</p>
  <p>To do this, we basically need few things (<em>the example is simplified)</em></p>
  <p>🔸 Cook pasta</p>
  <p>🔸 Cook bacon</p>
  <p>🔸 Mix the two</p>
  <p>🔸 Throw a bit of cheese in</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/d1/d1be7d2a-0ff7-4eea-8ecd-2e6427126b62.png" width="850" />
  </figure>
  <p>Now that the functions are done, let&#x27;s call them.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/15/15fb0c98-2417-423b-94b7-7d102fa86be6.png" width="502" />
  </figure>
  <p>Couldn&#x27;t be easier, right? What we end up to see in the console is a nice list of our actions.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/b5/b5344f1e-db76-4712-a896-ea14dcdbadff.png" width="728" />
  </figure>
  <p>Ready to get your lunch? Not so fast. To the left from the log you can see the time at which the function was fired. Looks like we outperformed Michelin star chefs and got pasta and bacon ready in just a few milliseconds.</p>
  <p><strong>Doesn&#x27;t look too realistic..</strong></p>
  <p>Let&#x27;s bring us back to reality and simulate at least a tiny lag in the first 2 functions. Don&#x27;t worry too much about the <code>setTimeout</code> function for now, what it does is simply waits for a bit and then logs the stuff we want.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/3c/3c158cd9-11c0-44d8-b15b-ce3da39720bd.png" width="688" />
  </figure>
  <p>Shouldn&#x27;t make it catastrophic, let&#x27;s see how the console looks right now.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/7b/7b51d531-e0a7-4f4d-afb6-859d8f09e4ed.png" width="590" />
  </figure>
  <p><strong>Shit. </strong>Something clearly got out of control. One cannot add bacon to pasta, put cheese on top before those 2 are not ready.</p>
  <p>This is what real life looks like though. And the problem we experienced here has something to do with the fact that all functions were fired simultaneously. In other words, JS didn&#x27;t care whether we finished cooking pasta, it went on launching other functions in the meantime.</p>
  <p>Since the example was simplified, you can only imagine what kind of damage to your app would this bring in the real world.</p>
  <h2>Callbacks</h2>
  <p>One way to deal with that is to use something known as callbacks. Regardless your favourite computer language, this will refer to a &quot;call after&quot; function, or in other words, anything executable that can be passed as an argument in your code.</p>
  <p>Sounds, realistic. Let&#x27;s give it a shot. To show how the callbacks work, the most simplified example will look like below:</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/5f/5f91c3f8-19c9-4ba9-84ec-896426f769a4.png" width="640" />
  </figure>
  <p>Also we are creating another function to notify us when the cooking has been finished.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/f9/f9628ff4-6ecd-40ca-a040-8b6b13c1f6df.png" width="554" />
  </figure>
  <p>Then calling all function and the first 2 with callbacks.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/cf/cf1430e6-bf2d-4218-85d8-f2a8702110d0.png" width="694" />
  </figure>
  <figure class="m_custom">
    <img src="https://teletype.in/files/bd/bdb85404-45f6-4287-bdee-18e11cf4259f.png" width="612" />
  </figure>
  <p>Looks like it worked. But bear in mind that the purpose here is to just show you the concept of callbacks. And you can guess that the more functions you have the more complicated it will get. Eventually with this technique, you might end up having loads of functions calling each other here and there. This has a huge potential to make your code massive and unreadable.</p>
  <p>That&#x27;s where the promises come in.</p>
  <h2>Promises</h2>
  <p>To put it simply, promises help us to wrap our functions and wait till something returns before moving on to the next function.</p>
  <p>In our case, we would like to cook the pasta first, then do the bacon and then all the mixing/finishing stuff.</p>
  <p>This is how the implementation can look like. We creating a promise, which will simply return the <strong>check emoji </strong>on success (on so-called &#x27;resolve&#x27;) and this will happen after a short time lag.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/e9/e93087c9-a43a-442d-81ce-d23d5a50a6b3.png" width="918" />
  </figure>
  <p>We then take this result and push it to our <code>prepare()</code> function. The prepare function has also been slightly modified and now also returns the dish after writing it to the console. This should then push it to the next <code>prepare() </code>and so on.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/a1/a12f3d79-c8d3-484a-b0c7-66f2f07eeec6.png" width="684" />
  </figure>
  <p>Looks good, we are now waiting for pasta to be prepared, <strong>then</strong> do the bacon when the pasta is ready, <strong>then</strong> the rest. This called <strong>chaining</strong> as we chain through all the <code>.then</code>.</p>
  <p>The above helps us to ensure we wait till the promise is resolved and then start cooking pasta. One example of how functions can be fired asynchronously.</p>
  <p>In the real world, you normally return something from the function then send it to the next function to use. For example, you could fetch some data from an API, parse it and then send to the next function (which would fail to properly run without getting something from the API first).</p>
  <p>The above example again, was simplified to familiarise you with the concept, in real life you will also specify what happens if the promise was rejected and catch errors in each <code>.then </code></p>
  <p>While this is still a better, cleaner solution than callbacks - it can also get pretty messy.</p>
  <h2>Sync/Await</h2>
  <p>Another way, which is still fairly new and was introduced with ES8 is sync and await. And the main goal is.. well make your code cleaner and smaller again.</p>
  <p>The idea here is extremely simple. We have to create a new <code>async function</code>, which is a fancy way of making the functions inside work asynchronously and specify whatever part of it needs to calm down and wait for a bit. This can nicely work with promises, but you can also just wait till the function returns you something.</p>
  <p>So for now let&#x27;s actually drop in a delay for each of the actions to simulate real case. For this we can create a simple function:</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/03/033454f3-3abb-45e5-a7cb-5f875b229751.png" width="896" />
  </figure>
  <p>Similar to the Promise example, we are creating a delay and on success it should pass the element further in the chain. Also, as it would happen in normal world, we substituted all our <code>console.log()</code> with <code>return</code> , so that now all functions should return something.</p>
  <p>Finally, instead of calling all functions one by one, we are going to create a separate function for this and call it later. And all you have to remember is this 2 things:</p>
  <p>🔸 You need to use the word async <code>next</code> to the function - this will allow usage of <code>await</code> and will make your code to work <strong>asynchronously</strong></p>
  <p>🔸 You will have to specify <code>await</code> where something needs to wait till it gets the something back</p>
  <p><strong>And please - </strong>Do not try to use awaits without specifying async first and do not attempt to await for something in the top level - this wouldn&#x27;t work. The 2 aforementioned points are must-have.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/95/95c3dc5a-a4ea-45a4-8ef1-cd68e290088b.png" width="1140" />
  </figure>
  <p>By looking at the code above, we should expect to see the following process:</p>
  <p>&#x27;start cooking&#x27; will be printed in console → then the variable will wait for 1250ms simulating the time delay for the specified functions. After each function we are also printing out whatever it got after waiting.</p>
  <p>Remember, we are now returning things, not printing them in the console. So our <code>combine</code> variable for example will have to use <code>dish</code> and <code>dish2</code> to mix them and won&#x27;t be able to do it until both are done.</p>
  <p>Finally, we are also adding a nice checkbox ✅ after the element showing us that it has been retrieved from the <code>waitTillFinish()</code> function.</p>
  <p>Here, let&#x27;s have a look what we got.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/b1/b179a036-9157-48ec-964f-d3bac19e6c81.gif" width="600" />
  </figure>
  <p>As you can see now we doing it all with approx. a 1 second delay <em>(still to quick, but good for demonstration)</em>. For combination we obviously getting 2 checks meaning pasta and bacon are ready and then the mixing is also done.</p>
  <p>You can try it yourself in the Chrome Dev tools, some things will differ, like you won&#x27;t have to use <code>.this</code> word and probably will need to specify <code>function Name</code> when creating one.</p>
  <p>Now that is done go make yourself some <strong>Carbonara</strong> and make sure you don&#x27;t add cheese until pasta and bacon are done (wouldn&#x27;t be good).</p>
  <h2>Join our telegram <a href="https://t.me/@thefrontend" target="_blank">@thefrontend</a></h2>
  <figure class="m_custom">
    <img src="https://www.carusopizza.cz/324-large_default/spaghetti-carbonara.jpg" width="820" />
  </figure>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@thefrontend/rkX2CFO0G</guid><link>https://teletype.in/@thefrontend/rkX2CFO0G?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend</link><comments>https://teletype.in/@thefrontend/rkX2CFO0G?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend#comments</comments><dc:creator>thefrontend</dc:creator><title>Collation of beautifull effects in CSS/SVG/JS</title><pubDate>Tue, 15 May 2018 16:45:31 GMT</pubDate><media:content medium="image" url="https://teletype.in/files/be/beddfad7-f22c-4854-9194-83400935974b.png"></media:content><description><![CDATA[<img src="https://teletype.in/files/99/9922623f-198d-4b10-a4bb-a76f2212b261.png"></img>Here is a list of some the nice effects, interesting ideas and useful components.]]></description><content:encoded><![CDATA[
  <p>Here is a list of some the nice effects, interesting ideas and useful components.</p>
  <p>Don&#x27;t reinvent the wheel, have a look and maybe on of the projects can fit in nicely into your development.</p>
  <h2>Animation about designers</h2>
  <figure class="m_custom">
    <img src="https://teletype.in/files/99/9922623f-198d-4b10-a4bb-a76f2212b261.png" width="1422" />
  </figure>
  <p><strong>Tech</strong>: CSS</p>
  <p><strong>Author</strong>: @miocene</p>
  <p><a href="https://codepen.io/miocene/pen/WJRXVg" target="_blank">View code</a></p>
  <h2>A horse in motion</h2>
  <figure class="m_custom">
    <img src="https://teletype.in/files/9d/9db987d1-1f89-4ef1-927f-85d3f1ca8ebd.gif" width="600" />
  </figure>
  <p><strong>Tech</strong>: CSS + Variative font</p>
  <p><strong>Author</strong>: @lorp</p>
  <p><a href="https://codepen.io/lorp/pen/PRdNYq" target="_blank">View code</a></p>
  <h2>Hanoi Tower (try to solve)</h2>
  <p>Goal - move all discs from the left tower to the right one.</p>
  <figure class="m_custom">
    <img src="https://teletype.in/files/9f/9f0fc7d1-a883-49cb-a340-df9e8c1e3a98.gif" width="600" />
  </figure>
  <p><strong>Tech</strong>: CSS</p>
  <p><strong>Author</strong>: @finnhvman</p>
  <p><a href="https://codepen.io/finnhvman/pen/gzmMaa" target="_blank">View code</a></p>
  <h2>Choose any time of the day</h2>
  <figure class="m_custom">
    <img src="https://teletype.in/files/7f/7fadb00d-ed28-4361-84dd-deeee6fd0e8d.gif" width="600" />
  </figure>
  <p><strong>Tech</strong>: CSS, SVG, JS</p>
  <p><strong>Author</strong>: @olivaele</p>
  <p><a href="https://codepen.io/oliviale/pen/ELPvLM" target="_blank">View code</a></p>
  <h2>SVG switcher between tabs</h2>
  <figure class="m_custom">
    <img src="http://css-live.ru/wp-content/uploads/2018/05/tabs.jpg" width="740" />
  </figure>
  <p><strong>Tech: </strong>CSS, SVG, JS</p>
  <p><strong>Author</strong>: @ainalem</p>
  <p><a href="https://codepen.io/ainalem/pen/vjxJMR" target="_blank">View code</a></p>
  <h2>Stretch scroll effect</h2>
  <figure class="m_custom">
    <img src="http://css-live.ru/wp-content/uploads/2018/05/stretch-scroll.jpg" width="740" />
  </figure>
  <p><strong>Tech</strong>: CSS, JS</p>
  <p><strong>Author</strong>: @nathantaylor</p>
  <p><a href="https://codepen.io/nathantaylor/pen/rvMaKY" target="_blank">View code</a></p>
  <h2>Interactive SVG mask</h2>
  <figure class="m_custom">
    <img src="https://teletype.in/files/9c/9c98663f-3b2c-47f3-a56e-45cef54f8b30.png" width="1048" />
  </figure>
  <p><strong>Tech</strong>: SVG mask, JS</p>
  <p><strong>Author: </strong>@PointC</p>
  <p><a href="https://codepen.io/PointC/pen/KRWgOK" target="_blank">View code</a></p>
  <h2>Day and Night</h2>
  <figure class="m_custom">
    <img src="http://css-live.ru/wp-content/uploads/2018/05/day-night.jpg" width="740" />
  </figure>
  <p><strong>Tech</strong>: CSS-variables, JS</p>
  <p><strong>Author</strong>: @CameronFitzwilliam</p>
  <p><a href="https://codepen.io/CameronFitzwilliam/pen/QrdLyN" target="_blank">View code</a></p>
  <p>Hope you liked it.</p>
  <h2>🔥Join our telegram @thefrontend</h2>
  <p><em>*Translated from <a href="http://css-live.ru/cssjssvg-s-podvypodvertom/ezhenedelnaya-podborka-krasivyx-effektov-na-css-svg-js-77.html" target="_blank">css-live</a></em></p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@thefrontend/H13d3-TTf</guid><link>https://teletype.in/@thefrontend/H13d3-TTf?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend</link><comments>https://teletype.in/@thefrontend/H13d3-TTf?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=thefrontend#comments</comments><dc:creator>thefrontend</dc:creator><title>TOP 10 CSS interview questions</title><pubDate>Sun, 06 May 2018 23:14:59 GMT</pubDate><media:content medium="image" url="https://teletype.in/files/80/800b1638-d536-497a-8333-9b99c07e3190.png"></media:content><description><![CDATA[<img src="https://teletype.in/files/63/638f60b4-fd75-4bcd-9b8b-db9ea63bd98c.jpeg"></img>Below is a list of CSS interview questions that you are very likely to face when applying for a front end position.]]></description><content:encoded><![CDATA[
  <figure class="m_custom">
    <img src="https://teletype.in/files/63/638f60b4-fd75-4bcd-9b8b-db9ea63bd98c.jpeg" width="1091" />
  </figure>
  <p>Below is a list of CSS interview questions that you are very likely to face when applying for a front end position.</p>
  <h2>🤨Q. What are the three main ways to add CSS to a webpage? Describe the advantages and disadvantages of each method.</h2>
  <p>🤓A. There are three ways to apply CSS to a webpage—inline, embedded, and as an external style sheet. The three approaches along with their pros and cons are described below.</p>
  <ul>
    <li>Inline CSS can be written directly into the HTML elements as a style attribute. The primary advantage of inline CSS is the ability to override other style specifications in the single instance of an HTML element that it is applied to. However, this is only feasible if there are a small number of style definitions. It is generally better to use embedded or external style sheets for more complex styles.</li>
    <li>External style sheets allow the developer to separate style from content, and control multiple HTML documents from a single separate file, making it easy to style the entirety of a site with a single document. It enables complex styling through classes, selectors, and other grouping methods. The disadvantage of an external CSS file is that it must be downloaded first for the HTML file to be properly rendered.</li>
    <li>Embedded CSS can be written within the &lt;style&gt; tags inside the &lt;head&gt; section of an HTML document. It shares many of the same advantages as the External Style Sheet, with access to classes, selectors, and more complex styling. Embedded CSS has the added advantage of loading with the HTML document—no extra download required. However, that also means that any external HTML documents will not inherit the styling of CSS written within these tags.</li>
  </ul>
  <h2>🤨Q. What are CSS media queries and what are they used for?</h2>
  <p>🤓A. CSS media queries are the filters that make responsive web design (RWD) possible. With the introduction of laptops, tablets, and smartphones with screens of varying sizes and aspect ratios, RWD is crucial for modern day app development. CSS media queries adjust content style based on device characteristics like width, height, orientation, resolution, and display type. When used properly, the end result is a website or app capable of providing a sleek UI/UX across multiple devices.</p>
  <h2>🤨<strong>Q. What is a CSS preprocessor? Would you recommend using one for this project?</strong></h2>
  <p>🤓A. A preprocessor is an abstraction layer built on top of CSS. Preprocessors extend the functionality of CSS by offering powerful features like variables, inheritable “classes” called extends, and “function-like” mixins. Sass, LESS, and Stylus are some of the more well-known preprocessors—try asking the developer which one they prefer more. Selecting a preprocessor really boils down to preference, and it can be revealing to see how a particular developer might decide to use one over the other for your project.</p>
  <h2>🤨Q. List the basic layout components of the CSS box model with a brief description for each</h2>
  <p>🤓A. In many ways, front-end web design is all about managing rectangles, and the CSS box model provides a layout paradigm for HTML elements that you can use to structure a webpage. The basic components are described below.</p>
  <ul>
    <li>border: The border surrounding the padding.</li>
    <li>content: Any text or images within the box.</li>
    <li>margin: The transparent area surrounding borders.</li>
    <li>padding: The transparent area surrounding content.</li>
  </ul>
  <h2>🤨Q. How would you implement the basic layout components of the box model in CSS? Give an example.</h2>
  <p>🤓A. Each element of the box model—border, content, margin, and padding—can be specified independently for each side of the element by listing dimensions in the following order: top, bottom, right, and left. Alternatively, multiple sides can be specified as a group by listing fewer parameters. An example has been provided below.</p>
  <pre>margin: 50px 100px 100px 50px;
/* Sets the top, right, bottom and left margins */

margin: 25px;
/* Sets the margin on all sides */

padding: 50px 100px;
/* Sets the top/bottom margin as a group and the right/left margin as a group */
</pre>
  <h2>🤨Q. Give an example of how you would use counter-increment and counter-reset in CSS to create automatic numbering within a webpage.</h2>
  <p>🤓A. The counter-reset and counter-increment properties allow a developer to automatically number CSS elements like an ordered list (&lt;ol&gt;). The counter-reset property resets a CSS counter to a given value. The counter-increment property then increases one or more counter values. Automatic numbering within a webpage is often useful, much like the section headers within this article. An example of how to use counters in CSS is displayed below.</p>
  <pre>body {
    counter-reset: foo;
}

h1 {
    counter-reset: bar;
}

h1:before {
    counter-increment: foo;
    content: &quot;Section &quot; counter(foo) &quot;. &quot;;
}

h2:before {
    counter-increment: bar;
    content: counter(foo) &quot;.&quot; counter(bar) &quot; &quot;; 
}
</pre>
  <h2>🤨Q. Describe the following common CSS units of length: cm, em, in, mm, pc, pt, and px.</h2>
  <p>🤓A. There are many ways to express units of length within CSS, but these are just some of the more common ones.</p>
  <ul>
    <li>cm: centimeters</li>
    <li>em: a relative unit of measurement based on the size of a font</li>
    <li>in: inches</li>
    <li>mm: millimeters</li>
    <li>pc: pica, a unit of length equivalent to 12 points, or 1/6 of an inch</li>
    <li>pt: 1/72 of an inch</li>
    <li>px: a device-specific relative measurement equivalent to a certain number of pixels on a display</li>
  </ul>
  <h2>🤨Q.What are CSS vendor prefixes? Can you name some of the more common ones that you’re familiar with?</h2>
  <p>🤓A. Depending on your project, you might be looking for a CSS developer who can take advantage of experimental non-standard features that are only available on certain platforms. Vendor prefixes are extensions to CSS standards that can be added to these features to prevent incompatibilities from arising when the standard is extended. CSS vendor prefixes for some common platforms are listed below.</p>
  <ul>
    <li>-webkit-: Android, Chrome, iOS, and Safari</li>
    <li>-moz-: Mozilla Firefox</li>
    <li>-ms-: Internet Explorer</li>
    <li>-o-: Opera</li>
  </ul>
  <h2>🤨Q. How do you define a pseudo class in CSS? What are they used for?</h2>
  <p>🤓A. You can define a pseudo class by listing the selector followed by a colon and finally the pseudo class element. Pseudo classes can be used to give elements special states—the most common example being <code>a:hover</code>, which is used to change the color of a link when a mouse hovers over it. Other uses include using distinct styling for visited and unvisited links and styling an element differently when focused.</p>
  <h2>🤨Q. How would you select all the PDF links in the code block below with a single line of code?</h2>
  <pre>&lt;body&gt;

&lt;p&gt;&lt;a href=&quot;default.asp&quot; target=&quot;_blank&quot;&gt;This is a link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;mydocument.pdf&quot; target=&quot;_blank&quot;&gt;This is a PDF&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;default.asp&quot; target=&quot;_blank&quot;&gt;This is a link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;mydocument.pdf&quot; target=&quot;_blank&quot;&gt;This is a PDF&lt;/a&gt;&lt;/p&gt;

&lt;/body&gt;
</pre>
  <p>🤓A big part of CSS is selecting and stylizing particular elements on a page. This question tests a developer’s knowledge of attribute selectors. All the elements of interest on the page happen to be links, but not all links are linking to PDFs. In CSS you can target the ending of the PDF link “.pdf” to quickly select all the PDF files by using the [attribute$=”value”] selector, which selects elements whose value ends with a specified value. In this case, we can use a[href$=“.pdf”] to select all PDF links.</p>

]]></content:encoded></item></channel></rss>