<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sammy Israwi</title>
    <description>The latest articles on DEV Community by Sammy Israwi (@sammyisa).</description>
    <link>https://dev.to/sammyisa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F29393%2F8a08b389-af82-4d0a-8e7b-055e48626e31.jpg</url>
      <title>DEV Community: Sammy Israwi</title>
      <link>https://dev.to/sammyisa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sammyisa"/>
    <language>en</language>
    <item>
      <title>Learning How Compilers Work, And Getting Stuck</title>
      <dc:creator>Sammy Israwi</dc:creator>
      <pubDate>Tue, 11 Jun 2019 14:22:03 +0000</pubDate>
      <link>https://dev.to/sammyisa/learning-how-compilers-work-and-getting-stuck-17jd</link>
      <guid>https://dev.to/sammyisa/learning-how-compilers-work-and-getting-stuck-17jd</guid>
      <description>&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This article is less of an instructional one, like previous articles, and more of a question + fun narration of my struggles with compilers so far. More instructional articles will come later on. &lt;/li&gt;
&lt;li&gt;This is about compilers only, not about Interpreters. I have no idea how interpreters work &lt;em&gt;yet&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Background
&lt;/h2&gt;

&lt;p&gt;Out of all the classes one takes as a CS student in university, some useless and some not so much, it might come to you as a surprise that I actually enjoyed the classes about programming languages and system software - it was certainly a surprise to me because I had no idea I had an interest in them! &lt;/p&gt;

&lt;p&gt;Particularly, I was interested in learning &lt;em&gt;how&lt;/em&gt; languages worked. All I knew beforehand is that programming languages are translated to machine code so that the computer understands what to do, because the computer doesn't understand &lt;a href="https://en.wikipedia.org/wiki/JSFuck" rel="noopener noreferrer"&gt;JSFuck&lt;/a&gt;. However, I had no idea how we go from human-readable programming language to machine-language, I thought of it for a while as translating Spanish to English. After I learned that was not the case, I simply thought of it being a black box of computer science magic and didn't push the subject.&lt;/p&gt;

&lt;p&gt;The Systems Software class at my university taught us a bit more about what was inside the black-box, they had us build a compiler for a simplified version of language called &lt;a href="https://en.wikipedia.org/wiki/PL/0" rel="noopener noreferrer"&gt;PL/0&lt;/a&gt;. It was the second time I took the class when it actually clicked for me and started being interesting, I can thank the professor for that. It was in said class where I learned about the steps of compiling a language (parser, analyzer, all that jazz) what an Abstract Syntax Tree (AST) was and how it was an intermediary step of compiling and a very powerful tool when understanding how a language works, and how a computer can understand it. &lt;/p&gt;

&lt;p&gt;All that backstory to bring you to this Tweet:&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1131020431052247043-816" src="https://platform.twitter.com/embed/Tweet.html?id=1131020431052247043"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1131020431052247043-816');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1131020431052247043&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;Which came right at a time when I wanted to delve deeper into developer experience tools. At the same time, as if by divine timing, my brother shared with me this repo about learning to build your own &lt;em&gt;anything&lt;/em&gt;:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/codecrafters-io" rel="noopener noreferrer"&gt;
        codecrafters-io
      &lt;/a&gt; / &lt;a href="https://github.com/codecrafters-io/build-your-own-x" rel="noopener noreferrer"&gt;
        build-your-own-x
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Master programming by recreating your favorite technologies from scratch.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;&lt;a href="https://codecrafters.io/github-banner" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/5ca90a5bbfca851d7f7242281f66eb8711e47a141d02a41be7590b80aa2fbdb6/68747470733a2f2f636f646563726166746572732e696f2f696d616765732f62796f782d62616e6e65722e676966" alt="Banner"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Build your own &amp;lt;insert-technology-here&amp;gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;This repository is a compilation of well-written, step-by-step guides for re-creating our favorite technologies from scratch.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;What I cannot create, I do not understand — Richard Feynman.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It's a great way to learn.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-3d-renderer" rel="noopener noreferrer"&gt;3D Renderer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-augmented-reality" rel="noopener noreferrer"&gt;Augmented Reality&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-bittorrent-client" rel="noopener noreferrer"&gt;BitTorrent Client&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-blockchain--cryptocurrency" rel="noopener noreferrer"&gt;Blockchain / Cryptocurrency&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-bot" rel="noopener noreferrer"&gt;Bot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-command-line-tool" rel="noopener noreferrer"&gt;Command-Line Tool&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-database" rel="noopener noreferrer"&gt;Database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-docker" rel="noopener noreferrer"&gt;Docker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-emulator--virtual-machine" rel="noopener noreferrer"&gt;Emulator / Virtual Machine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-front-end-framework--library" rel="noopener noreferrer"&gt;Front-end Framework / Library&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-game" rel="noopener noreferrer"&gt;Game&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-git" rel="noopener noreferrer"&gt;Git&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-network-stack" rel="noopener noreferrer"&gt;Network Stack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-neural-network" rel="noopener noreferrer"&gt;Neural Network&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-operating-system" rel="noopener noreferrer"&gt;Operating System&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-physics-engine" rel="noopener noreferrer"&gt;Physics Engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-programming-language" rel="noopener noreferrer"&gt;Programming Language&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-regex-engine" rel="noopener noreferrer"&gt;Regex Engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-search-engine" rel="noopener noreferrer"&gt;Search Engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-shell" rel="noopener noreferrer"&gt;Shell&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-template-engine" rel="noopener noreferrer"&gt;Template Engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-text-editor" rel="noopener noreferrer"&gt;Text Editor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-visual-recognition-system" rel="noopener noreferrer"&gt;Visual Recognition System&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-voxel-engine" rel="noopener noreferrer"&gt;Voxel Engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-web-browser" rel="noopener noreferrer"&gt;Web Browser&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#build-your-own-web-server" rel="noopener noreferrer"&gt;Web Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/codecrafters-io/build-your-own-x#uncategorized" rel="noopener noreferrer"&gt;Uncategorized&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Tutorials&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h4 class="heading-element"&gt;Build your own &lt;code&gt;3D Renderer&lt;/code&gt;
&lt;/h4&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing/how-does-it-work" rel="nofollow noopener noreferrer"&gt;&lt;strong&gt;C++&lt;/strong&gt;: &lt;em&gt;Introduction to Ray Tracing: a Simple Method for Creating 3D Images&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ssloy/tinyrenderer/wiki" rel="noopener noreferrer"&gt;&lt;strong&gt;C++&lt;/strong&gt;: &lt;em&gt;How OpenGL works: software rendering in 500 lines of code&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://lodev.org/cgtutor/raycasting.html" rel="nofollow noopener noreferrer"&gt;&lt;strong&gt;C++&lt;/strong&gt;: &lt;em&gt;Raycasting engine of Wolfenstein 3D&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.pbr-book.org/" rel="nofollow noopener noreferrer"&gt;&lt;strong&gt;C++&lt;/strong&gt;: &lt;em&gt;Physically Based Rendering:From Theory To Implementation&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raytracing.github.io/books/RayTracingInOneWeekend.html" rel="nofollow noopener noreferrer"&gt;&lt;strong&gt;C++&lt;/strong&gt;: &lt;em&gt;Ray Tracing in One Weekend&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.scratchapixel.com/lessons/3d-basic-rendering/rasterization-practical-implementation/overview-rasterization-algorithm" rel="nofollow noopener noreferrer"&gt;&lt;strong&gt;C++&lt;/strong&gt;: &lt;em&gt;Rasterization: a Practical Implementation&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.davrous.com/2013/06/13/tutorial-series-learning-how-to-write-a-3d-soft-engine-from-scratch-in-c-typescript-or-javascript/" rel="nofollow noopener noreferrer"&gt;&lt;strong&gt;C#&lt;/strong&gt;&lt;/a&gt;…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/codecrafters-io/build-your-own-x" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Which links to this repo about building your own compiler in JavaScript:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/jamiebuilds" rel="noopener noreferrer"&gt;
        jamiebuilds
      &lt;/a&gt; / &lt;a href="https://github.com/jamiebuilds/the-super-tiny-compiler" rel="noopener noreferrer"&gt;
        the-super-tiny-compiler
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      ⛄ Possibly the smallest compiler ever
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;&lt;a href="https://github.com/jamiebuilds/the-super-tiny-compilerthe-super-tiny-compiler.js" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcloud.githubusercontent.com%2Fassets%2F952783%2F21579290%2F5755288a-cf75-11e6-90e0-029529a44a38.png" alt="The Super Tiny Compiler"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Welcome to The Super Tiny Compiler!&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is an ultra-simplified example of all the major pieces of a modern compiler
written in easy to read JavaScript.&lt;/p&gt;
&lt;p&gt;Reading through the guided code will help you learn about how &lt;em&gt;most&lt;/em&gt; compilers
work from end to end.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;&lt;a href="https://github.com/jamiebuilds/the-super-tiny-compilerthe-super-tiny-compiler.js" rel="noopener noreferrer"&gt;Want to jump into the code? Click here&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;&lt;a href="https://the-super-tiny-compiler.glitch.me/" rel="nofollow noopener noreferrer"&gt;You can also check it out on Glitch&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Why should I care?&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;That's fair, most people don't really have to think about compilers in their day
jobs. However, compilers are all around you, tons of the tools you use are based
on concepts borrowed from compilers.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;But compilers are scary!&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;Yes, they are. But that's our fault (the people who write compilers), we've
taken something that is reasonably straightforward and made it so scary that
most think of it as this totally unapproachable thing that only the nerdiest of
the nerds are able to understand.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Okay so where&lt;/h3&gt;…&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/jamiebuilds/the-super-tiny-compiler" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Which came from that fantastic article by &lt;a href="https://dev.to/mattsparks"&gt;@mattsparks&lt;/a&gt;:&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/mattsparks" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F68777%2F7aaeb224-6b1d-42b8-9703-b7f4de3707eb.jpg" alt="mattsparks"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/mattsparks/learn-5-github-repos-with-great-free-open-source-resources-38de" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🧠 Learn! 5 Github Repos With Great Free &amp;amp; Open Source Resources&lt;/h2&gt;
      &lt;h3&gt;Matt Sparks ・ May 29 '19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#opensource&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#programming&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  The Current Situation
&lt;/h2&gt;

&lt;p&gt;So, I started going over the Super Tiny Compiler to understand how it works, and converting it to TypeScript to prove to myself that I understand what is happening in the different stages of the compiler. &lt;/p&gt;

&lt;p&gt;I have been doing just that in a repository is a fork of the previously mentioned one, and you can find it here:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/SammyIsra" rel="noopener noreferrer"&gt;
        SammyIsra
      &lt;/a&gt; / &lt;a href="https://github.com/SammyIsra/the-super-tiny-compiler" rel="noopener noreferrer"&gt;
        the-super-tiny-compiler
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      ⛄ Possibly the smallest compiler ever
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;My first attempt (out of school) to learn how compilers work, and what tf an AST is&lt;/p&gt;
&lt;p&gt;This version will be in TypeScript mostly because that is a good way for me to properly understand how it works&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Original README below this line&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://github.com/SammyIsra/the-super-tiny-compilerthe-super-tiny-compiler.js" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcloud.githubusercontent.com%2Fassets%2F952783%2F21579290%2F5755288a-cf75-11e6-90e0-029529a44a38.png" alt="The Super Tiny Compiler"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Welcome to The Super Tiny Compiler!&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is an ultra-simplified example of all the major pieces of a modern compiler
written in easy to read JavaScript.&lt;/p&gt;
&lt;p&gt;Reading through the guided code will help you learn about how &lt;em&gt;most&lt;/em&gt; compilers
work from end to end.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;&lt;a href="https://github.com/SammyIsra/the-super-tiny-compilerthe-super-tiny-compiler.js" rel="noopener noreferrer"&gt;Want to jump into the code? Click here&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;&lt;a href="https://the-super-tiny-compiler.glitch.me/" rel="nofollow noopener noreferrer"&gt;You can also check it out on Glitch&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Why should I care?&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;That's fair, most people don't really have to think about compilers in their day
jobs. However, compilers are all around you, tons of the tools you use are based
on concepts borrowed from compilers.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;But compilers are scary!&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;Yes, they are. But that's…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/SammyIsra/the-super-tiny-compiler" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The first two steps were not so bad:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The first step (the &lt;a href="https://the-super-tiny-compiler.glitch.me/tokenizer" rel="noopener noreferrer"&gt;Tokenizer&lt;/a&gt;) turns the input string in the starting language to a series of tokens, each token identified as a Parenthesis, Number, String, or Name.&lt;/li&gt;
&lt;li&gt;The second step (the &lt;a href="https://the-super-tiny-compiler.glitch.me/parser" rel="noopener noreferrer"&gt;Parser&lt;/a&gt;) navigates the token list and creates a simple AST by analyzing the token list and determining what kind of node each token is and if the following ones are children nodes. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I'll go into a deeper discussion on the matter in more instructional articles, and they will come with drawings since that is how I first understood these topics.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Blocker
&lt;/h2&gt;

&lt;p&gt;Steps #3 and #4 (the &lt;a href="https://the-super-tiny-compiler.glitch.me/traverser" rel="noopener noreferrer"&gt;Traverser&lt;/a&gt; and the &lt;a href="https://the-super-tiny-compiler.glitch.me/transformer" rel="noopener noreferrer"&gt;Transformer&lt;/a&gt;) is where I am currently stuck at. These steps seem to live together in the sense that they perform the next step in the compiling process.&lt;/p&gt;

&lt;p&gt;However, I am at a loss when trying to understand how we get the simple AST from step 2 and turn it into the more complicated one that the Code Generation step can use to create the compiler output, and how to turn that knowledge into the Types created by said steps.&lt;/p&gt;

&lt;p&gt;The way I understand this section of the compiler is that the Transformer takes in the Traverser and the Simple AST, creates a "visitor" which dictates what happens when finding a node of a specific type in the Simple AST, and it outputs the New AST (as is referred to in the code), which is the input the Code Generation step uses to create the output code.&lt;/p&gt;

&lt;p&gt;So this is where I lay my question and my request for help, the Traverser and the Transformer steps of the compiler are not the clearest subjects for me, so if you have any knowledge about them or if you have a similar experience to mine, I'd love to hear about it.&lt;/p&gt;




&lt;p&gt;Quick note. After writing this article, I have since found this video from the same author: &lt;a href="https://www.youtube.com/watch?v=Tar4WgAfMr4" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=Tar4WgAfMr4&lt;/a&gt; &lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>JS Project Setup: Code Quality is simple when you don't have to do anything</title>
      <dc:creator>Sammy Israwi</dc:creator>
      <pubDate>Fri, 08 Feb 2019 01:43:59 +0000</pubDate>
      <link>https://dev.to/sammyisa/js-project-setup-code-quality-is-simple-when-you-dont-have-to-do-anything-523e</link>
      <guid>https://dev.to/sammyisa/js-project-setup-code-quality-is-simple-when-you-dont-have-to-do-anything-523e</guid>
      <description>&lt;p&gt;The JavaScript, Web, and Node community is blessed these days by having easy-to-use (and not so easy-to-use) tools at our fingertips, along with documentation for them written by dedicated members of the community. &lt;/p&gt;

&lt;p&gt;This post is about setting up the simplest quick-and-easy pipeline with some well known tools like &lt;a href="https://prettier.io/" rel="noopener noreferrer"&gt;Prettier&lt;/a&gt; for code quality/readibility, and &lt;a href="https://github.com/typicode/husky" rel="noopener noreferrer"&gt;Husky&lt;/a&gt; for automatically enforcing those rules in our codebase. &lt;/p&gt;

&lt;p&gt;In some later posts we'll add build steps, testing, and some technology-specific tools like React and TypeScript. However, today we're keeping it simple and clean with only Prettier and Husky.&lt;/p&gt;

&lt;p&gt;Also, keep in mind that many existing tools and frameworks like Create React App, Gatsby, and so on, already provide some of the tooling mentioned here. However, we are starting from zero because our purpose is mostly to learn about the tools and understand why they are used.&lt;/p&gt;

&lt;p&gt;Once we understand how easy it is to set up these code quality tools, that is one less hurdle to jump through when trying to use these in your own project.&lt;/p&gt;

&lt;h2&gt;
  
  
  But Sammy, Why?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"That which cannot be automated, cannot be enforced." &lt;br&gt;
-Brian Holt, &lt;a href="https://twitter.com/holtbt" rel="noopener noreferrer"&gt;@holtbt&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;High quality, familiar, consistent code is easier to read and understand. Additionally, code similar to your own is easier for you to understand. &lt;/p&gt;




&lt;h2&gt;
  
  
  How do I start?
&lt;/h2&gt;

&lt;p&gt;Ok, step #1 is simple: create a new npm project, create a JS file, and write the ugliest, nastiest, most unreadable (but working) code you've written. Ignore style rules, best practices, and ignore what mean people say on Twitter. Get that out of your system.&lt;/p&gt;

&lt;p&gt;Now that you got an unholy mess in front of you, our first of the two tools comes into play:&lt;/p&gt;

&lt;h2&gt;
  
  
  Prettier
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Because sometimes we can't be trusted.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We are using Prettier version &lt;code&gt;1.16.4&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Prettier is a code formatter - this means that it will grab your code and apply its own consistent style rules on it. It has some flexibility, but generally developers use the default rules to keep style consistent across projects.&lt;/p&gt;

&lt;p&gt;Prettier will turn this inconsistent one-liner mess:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;funkyFilteredNames&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;defaultNames&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;names&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLocaleLowerCase&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLocaleUpperCase&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Into this readable snippet:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;funkyFilteredNames&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;defaultNames&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;names&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLocaleLowerCase&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLocaleUpperCase&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;How&lt;/em&gt; it does it is up to you. You can use Prettier as a CLI tool or you can let your text editor of choice handle it. To keep it simple (and let you use whatever you want) we are going to use the Prettier CLI.&lt;/p&gt;

&lt;p&gt;If you want to see how to install Prettier on your IDE, check out &lt;a href="https://prettier.io/docs/en/editors.html#docsNav" rel="noopener noreferrer"&gt;their docs on the matter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First things first - install Prettier: &lt;code&gt;npm i -D prettier&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now do me a favor: open the file where your messy code is, and open the command line on the same directory as your file. While looking at your code, enter the following command:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx prettier *.js --write
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;And boom, no longer a mess!&lt;/p&gt;

&lt;p&gt;Congratulations, you have code style rules in your codebase! To make this easier, we will make the above snippet an npm script, with a few changes to find all JavaScript files:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// package.json:&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ...&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;scripts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// other scripts&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;pretty&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;prettier &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;**/*.js&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt; --write&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now you only have to run &lt;code&gt;npm run pretty&lt;/code&gt; from within your project to format all the js files in it! &lt;/p&gt;

&lt;p&gt;Congratulations, you made it easy! ✨&lt;/p&gt;

&lt;p&gt;You can also make Prettier check the code instead of formatting it, and erroring the console out when the code isn't formatted:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"pretty-check": "prettier \"**/*.js\" --list-different"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;But what about reminding yourself to run the formatter? Are you completely sure that you will run the Prettier every time? That's where our second tool for today comes in: Husky!&lt;/p&gt;
&lt;h2&gt;
  
  
  Husky
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Because we so easily forget&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We are using Husky version &lt;code&gt;1.3.1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;🐕 Husky makes it easier for us to write Git Hooks - commands that run when we call specific Git actions. We will use it to make sure that Prettier checks the code when trying to commit to the repository.&lt;/p&gt;

&lt;p&gt;The steps for husky are simple, starting with the configuration file, which defines our hooks!&lt;/p&gt;

&lt;p&gt;Create a file called &lt;code&gt;.huskyrc&lt;/code&gt; in the root of your project, and write in the following text to define a &lt;strong&gt;hook&lt;/strong&gt; that will run &lt;strong&gt;pretty-check&lt;/strong&gt; before every &lt;strong&gt;commit&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "hooks": {
    "pre-commit": "npm run pretty-check"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Then we install Husky: &lt;code&gt;npm i -D husky&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Note: it is important that you install Husky &lt;em&gt;after&lt;/em&gt; defining the &lt;code&gt;.huskyrc&lt;/code&gt; file. If anything, you can always reinstall the package. Additionally, you should delete the .git/hooks folder if Husky is still not working, and then reinstall the package. You can read a bit more about it &lt;a href="https://github.com/typicode/husky/issues/445" rel="noopener noreferrer"&gt;in this GitHub issue&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now go to one of your files and write some ugly code. No need to make a mess like last time, a single single quoted string would be enough!&lt;/p&gt;

&lt;p&gt;Save and attempt to commit the file and you will see this at the end of the response:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FMg1jDcb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FMg1jDcb.png" alt="Prompts from Husky, rejecting the commit"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Husky rejected the commit because Prettier checked the code, and found that the code does not follow Prettier standards!&lt;/p&gt;

&lt;p&gt;If you want, you can change the pre-commit hook to format the code instead of just checking it by changing the content of `&lt;code&gt;"pre-commit"&lt;/code&gt; to execute &lt;code&gt;pretty&lt;/code&gt; instead of &lt;code&gt;pretty-check&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Congratulations, you made it automatic! ✨&lt;/p&gt;



&lt;p&gt;These days, setting up your workspace with a formatter is not difficult, and it goes great lengths for readability of your code. &lt;/p&gt;

&lt;p&gt;Prettier is one today's most used JavaScript formatter with almost 3.5 million downloads weekly, and the developers have done a great job at making it easy to use and understand.&lt;/p&gt;

&lt;p&gt;Husky allows us to write git commit hooks without much overhead or effort. Combined with Prettier, it makes it really hard to commit code that is inconsistent with the Prettier style guide.&lt;/p&gt;

&lt;p&gt;I have set up this small project for you to check out the steps I described in the article:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/SammyIsra" rel="noopener noreferrer"&gt;
        SammyIsra
      &lt;/a&gt; / &lt;a href="https://github.com/SammyIsra/JsEasyPipeline" rel="noopener noreferrer"&gt;
        JsEasyPipeline
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Example of a JS project with pipeline and code quality tools 📝
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;JsEasyPipeline&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;Accompanying project to my articles on Dev.to about implementing a JS pipeline/workspace tools 📝&lt;/p&gt;




&lt;p&gt;The repo will have examples on how to implement various tools like Prettier, Husky, ESLint, TravisCI, TypeScript, and similar tools in that style.&lt;/p&gt;




&lt;p&gt;This project shows how to implement project tools for JavaScript projects. The articles where I explain the tools are here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://github.com/SammyIsra/JsEasyPipeline" rel="noopener noreferrer"&gt;Prettier and Husky&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/SammyIsra/JsEasyPipeline" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;Check out the branch &lt;code&gt;Part1.PrettierAndHusky&lt;/code&gt; for the code specifically for this article.&lt;/p&gt;




&lt;p&gt;❤️ Thank you all for reading! More parts of this series will come later. I hope to use ESLint, TravisCI, and my own personal tools in future articles.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>web</category>
      <category>node</category>
      <category>devops</category>
    </item>
    <item>
      <title>Do you use Service Workers in production? How has your experience been like? </title>
      <dc:creator>Sammy Israwi</dc:creator>
      <pubDate>Thu, 14 Jun 2018 13:23:12 +0000</pubDate>
      <link>https://dev.to/sammyisa/do-you-use-service-workers-in-production-how-has-your-experience-been-like--397b</link>
      <guid>https://dev.to/sammyisa/do-you-use-service-workers-in-production-how-has-your-experience-been-like--397b</guid>
      <description>&lt;p&gt;If you have used Service Workers in  production, I'd like to hear about it!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;How did you realize you needed them?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How was your experience setting it up, and maintaining it? &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Results? Demos? &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you all!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>serviceworker</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Optional Chaining may be coming to JavaScript</title>
      <dc:creator>Sammy Israwi</dc:creator>
      <pubDate>Tue, 20 Feb 2018 00:49:49 +0000</pubDate>
      <link>https://dev.to/sammyisa/optional-chaining-may-be-coming-to-javascript--4ff0</link>
      <guid>https://dev.to/sammyisa/optional-chaining-may-be-coming-to-javascript--4ff0</guid>
      <description>&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Optional Chaining is finally in &lt;a href="https://tc39.github.io/process-document/" rel="noopener noreferrer"&gt;Stage 4&lt;/a&gt;!! Which means it is part of the ES2020 specification. It has also already made it to &lt;a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#optional-chaining" rel="noopener noreferrer"&gt;TypeScript v3.7&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here's the &lt;a href="https://github.com/tc39/proposal-optional-chaining" rel="noopener noreferrer"&gt;repo with all the info you need&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is it?
&lt;/h2&gt;

&lt;p&gt;Optional Chaining allows us to check if an object exists before trying to access its properties. Some other languages have something similar. C#, for example, has a Null Conditional Operator that behaves very similarly as the proposed Optional Chaining.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do we need it?
&lt;/h2&gt;

&lt;p&gt;Have you ever had to check for the existence of objects or arrays before accessing its properties? If you forget, it may look a little bit like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;specimen&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;specimen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;arms&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;specimen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;arms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This is probably an alien&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The reason why we do these checks is because in JavaScript allows for anonymous objects that don't necessarily have a structure or schema. Therefore if we don't check for parents in an object tree, we get a lot of errors that look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmgix19cp51akljtssiyv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmgix19cp51akljtssiyv.png" alt="TypeError error message" width="800" height="39"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because, at least in the case of the error, &lt;code&gt;specimen&lt;/code&gt; does exist, but it does not have an &lt;code&gt;arms&lt;/code&gt; property. Therefore, we tried to get &lt;code&gt;length&lt;/code&gt; of something that was &lt;code&gt;undefined&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, what's the proposal?
&lt;/h2&gt;

&lt;p&gt;Instead of all that, we can &lt;em&gt;chain&lt;/em&gt; optional checks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;specimen&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;arms&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This is probably an alien&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, keep in mind that the Optional Chaining operator is &lt;code&gt;?.&lt;/code&gt; not &lt;code&gt;?&lt;/code&gt; - this means that when using it to access an item in an array, it will look like this instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;firstArm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;specimen&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;arms&lt;/span&gt;&lt;span class="p"&gt;?.[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;//CORRECT&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;secondArm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;specimen&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;arms&lt;/span&gt;&lt;span class="p"&gt;?[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;//WRONG&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, when using it to check for the existence of functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;kickPromise&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;specimen&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;kick&lt;/span&gt;&lt;span class="p"&gt;?.();&lt;/span&gt;  &lt;span class="c1"&gt;//CORRECT&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;punchPromise&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;specimen&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;punch&lt;/span&gt;&lt;span class="p"&gt;?();&lt;/span&gt; &lt;span class="c1"&gt;//WRONG&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, we check if &lt;code&gt;kick&lt;/code&gt; exists before calling it as a function!&lt;/p&gt;

&lt;h2&gt;
  
  
  How does it work?
&lt;/h2&gt;

&lt;p&gt;The operator checks if whatever is to the &lt;strong&gt;Left-Hand Side&lt;/strong&gt; of &lt;code&gt;?.&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;. If it is, then the expression short-circuits and returns &lt;code&gt;undefined&lt;/code&gt;. Otherwise, the expression continues to evaluate as if nothing is wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  When can I use it?
&lt;/h2&gt;

&lt;p&gt;Well, it is still a proposal so it's not in Vanilla JavaScript just yet. However, it is usable &lt;a href="https://github.com/babel/babel/pull/5813" rel="noopener noreferrer"&gt;with Babel!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To stay up to date with the status of the proposal, as well as to have a more in-depth understanding and to check some examples, you should check &lt;a href="https://github.com/tc39/proposal-optional-chaining" rel="noopener noreferrer"&gt;their GitHub repo&lt;/a&gt;! You can also find the &lt;a href="https://tc39.github.io/proposal-optional-chaining/" rel="noopener noreferrer"&gt;specs here&lt;/a&gt;, but I won't get into that since most of that document goes way over my head 😅&lt;/p&gt;

&lt;h2&gt;
  
  
  Thank you!
&lt;/h2&gt;

&lt;p&gt;You're welcome! ❤️&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tc39</category>
      <category>ecmascript</category>
    </item>
    <item>
      <title>Explain The New React Context API Like I'm Five</title>
      <dc:creator>Sammy Israwi</dc:creator>
      <pubDate>Sun, 04 Feb 2018 23:08:04 +0000</pubDate>
      <link>https://dev.to/sammyisa/explain-the-new-react-contect-api-like-im-five-1aho</link>
      <guid>https://dev.to/sammyisa/explain-the-new-react-contect-api-like-im-five-1aho</guid>
      <description>&lt;p&gt;Recently React got &lt;a href="https://github.com/reactjs/rfcs/pull/2"&gt;a new version of Context&lt;/a&gt; and I've seen a lot of hype about it in Twitter but I'm not sure if I understand the use case of Context, or why this is a needed change. Can anyone help me understand how it works/what it solves?&lt;/p&gt;

&lt;p&gt;Thank you!&lt;/p&gt;

</description>
      <category>explainlikeimfive</category>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The status of Meteor on Windows in 2017</title>
      <dc:creator>Sammy Israwi</dc:creator>
      <pubDate>Fri, 03 Nov 2017 17:33:07 +0000</pubDate>
      <link>https://dev.to/sammyisa/the-status-of-meteor-on-windows-in-november-2017-79j</link>
      <guid>https://dev.to/sammyisa/the-status-of-meteor-on-windows-in-november-2017-79j</guid>
      <description>&lt;h2&gt;
  
  
  Premise and fall from grace â˜„ï¸
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;If you don't care about backstory, jump to "And then we're here".&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you don't know about &lt;a href="https://www.meteor.com/" rel="noopener noreferrer"&gt;Meteor&lt;/a&gt;, I suggest you read the official pitch on their website. This article is more about the state of it on Windows today. &lt;/p&gt;

&lt;p&gt;Ok so, Meteor for me is how I got into web development for real. I used it heavily in 2015 for my Summer internship at Spiceworks after my mentor recommended it. An easy to use, full stack Javascript framework that blurs the line between Front end and Back end? I was in love!&lt;/p&gt;

&lt;p&gt;Sure, it had some performance issues on Windows, but nothing breaking. At the time, I didn't really have to care about deployment since we were dealing with a demo. We could use the free demo hosting MDG provided for Meteor applications. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/meteor/meteor/issues/18" rel="noopener noreferrer"&gt;From the start&lt;/a&gt;, Meteor always considered Windows as a side thought, never giving true &lt;a href="https://github.com/meteor/meteor/issues/4155" rel="noopener noreferrer"&gt;mobile support for Windows&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;I even gave a couple of talks to the local ACM chapter about it! Did a demo deployment and everyone was surprised and they were starting to see why Meteor was great. Meteor was my solve-all solution. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FkVDwx1v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FkVDwx1v.png" alt="ACM Presentation cover"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;From my presentation for ACM&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Fast forward to one particularly annoying afternoon. A couple of friends asked me to do a short workshop on Meteor to get their feet wet. We could not even get Meteor running on their machines. The installer would work, and it would create the starter project, but the project would not run. After some digging and googling, we found out it was a Windows-specific issue on the current version. Delete everything and start a new project with an older version and no problem. &lt;/p&gt;

&lt;p&gt;After that, it was one issue after another. I decided to use it last year for Georgia Tech Hackathon where my friends and I decided to create &lt;a href="https://devpost.com/software/lacodinggranja_2016" rel="noopener noreferrer"&gt;FlavoredNews: a news client that would sentimentally analyze news and color code them&lt;/a&gt;. It was an interesting project, and to my delight Meteor was working flawlessly &lt;em&gt;until we had to deploy&lt;/em&gt;. We spent over an hour and a half figuring out how to deploy for free (probably would have been less time if I weren't sleep deprived) and in the end decided to deploy it to &lt;a href="https://www.meteor.com/hosting" rel="noopener noreferrer"&gt;MDG's very own Galaxy&lt;/a&gt; and eat the cost. Granted, it ended up being only a few dollars at most; but we were expecting to spend a grand total of zero dollars (as we usually do in Hackathons).&lt;/p&gt;

&lt;p&gt;Sometimes you just want to bundle and deploy to a platform like Azure and AWS, where you are either in a free tier or have student credits. &lt;/p&gt;

&lt;p&gt;I recently was pointed towards &lt;a href="https://medium.com/@leonardykris/how-to-run-a-meteor-js-application-on-heroku-in-10-steps-7aceb12de234" rel="noopener noreferrer"&gt;this article that gives you a step by step process for deploying  Meteor apps to Heroku&lt;/a&gt;, we will be trying that out for size today.&lt;/p&gt;

&lt;p&gt;After the entire debacle left a sour taste, I dropped Meteor hoping to pick it up in the future when it had better Windows support. &lt;/p&gt;

&lt;p&gt;TL;DR: Meteor promises a lot as long as your dev machine is not Windows&lt;/p&gt;
&lt;h2&gt;
  
  
  And then we're here! ðŸ
&lt;/h2&gt;

&lt;p&gt;We're going to try something really simple today. My goal is to install Meteor create an application, do some minor changes, and deploy to Heroku using &lt;a href="https://medium.com/@leonardykris/how-to-run-a-meteor-js-application-on-heroku-in-10-steps-7aceb12de234" rel="noopener noreferrer"&gt;this guide mentioned above&lt;/a&gt; or something similar.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Important note: &lt;br&gt;
This article was modified from the original publication. A little after making the article public, I attempted a few more things and Meteor worked as intended. Simple stuff like &lt;a href="https://github.com/meteor/meteor-chocolatey-installer/issues/1" rel="noopener noreferrer"&gt;giving the choco installer more time to finish&lt;/a&gt; did the trick. Anything after this point is more accurate to what I discovered after publishing. &lt;br&gt;
Sorry for the confusion!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For reference, here is my OS info:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\Users\Sammy-Surface&amp;gt; systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.15063 N/A Build 15063
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Installing ðŸ’»
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.meteor.com/install" rel="noopener noreferrer"&gt;Installing seems fairly simple these days:&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FID2VrJ6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FID2VrJ6.png" alt="Install steps"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, run the command on an admin shell and wait for a bit for the download and installation process to finish.&lt;/p&gt;

&lt;p&gt;If you are erroring out, there is a good chance the choco installer is timing out. To increase the timeout, run instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\Users\Sammy-Surface&amp;gt; choco install meteor -y --execution-timeout 10000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep in mind, this process &lt;em&gt;will take a while&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Starting a project ðŸš¦
&lt;/h3&gt;

&lt;p&gt;Creating a project is also simple. On a terminal, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\Users\Sammy-Surface\Development&amp;gt; meteor create nothing-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This may take a while; Meteor is not a lightweight platform. &lt;/p&gt;

&lt;p&gt;At this point, there is are a few common errors that will stop your progress. If you get an NPM error during the &lt;code&gt;create&lt;/code&gt; process, there is a chance your environment was not reset after installing Meteor. Try to close all command prompts and terminals you have open and reopen it. There are a few other errors that may pop up, &lt;a href="https://github.com/meteor/meteor/issues/8585" rel="noopener noreferrer"&gt;hopefully you can find your answer here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Development ðŸ› ï¸
&lt;/h3&gt;

&lt;p&gt;For the development section, we will add support for users in our boilerplate app. For starters, we will add the meteor packages &lt;code&gt;accounts-ui&lt;/code&gt; and &lt;code&gt;accounts-password&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\Users\Sammy-Surface\Development\nothing-app&amp;gt; meteor add accounts-ui accounts-password

Changes to your project's package version selections:

...

accounts-ui: Simple templates to add login widgets to an app
accounts-password: Password support for accounts

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will set up the configuration for the Accounts package on &lt;code&gt;client/main.js&lt;/code&gt;. If you have on file only what is relevant, it should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Template&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;meteor/templating&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ReactiveVar&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;meteor/reactive-var&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Accounts&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;meteor/accounts-base&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./main.html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;Accounts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ui&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;config&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;passwordSignupFields&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;USERNAME_ONLY&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And somewhere in your main.html, add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"login"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    {{&amp;gt; loginButtons}}
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now your website should look like this!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FNjsnRUA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FNjsnRUA.png" alt="See your first changes on the website"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We did not hit any snags! Good for us, proud of Meteor over here. Installing packages easy and it worked. &lt;/p&gt;

&lt;h3&gt;
  
  
  Deployment ðŸš€
&lt;/h3&gt;

&lt;p&gt;For this section, we will follow &lt;a href="https://medium.com/@leonardykris/how-to-run-a-meteor-js-application-on-heroku-in-10-steps-7aceb12de234" rel="noopener noreferrer"&gt;this ten step guide mentioned above&lt;/a&gt;. This will mean we are deploying to Heroku, therefore you need to &lt;a href="https://signup.heroku.com/login" rel="noopener noreferrer"&gt;set up an account with Heroku&lt;/a&gt; and download the &lt;a href="https://devcenter.heroku.com/articles/heroku-cli#windows" rel="noopener noreferrer"&gt;Heroku CLI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are two key points to remember here: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We are using a custom &lt;a href="https://devcenter.heroku.com/articles/buildpacks" rel="noopener noreferrer"&gt;buildpack&lt;/a&gt; made specifically for Meteor. There are many of these out there, this one is &lt;a href="https://github.com/AdmitHub/meteor-buildpack-horse" rel="noopener noreferrer"&gt;updated and currently maintained&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;We are using a remote MongoDB instance instead of a local version of it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that's it! Go to your Heroku app's website and you will see your application!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion ðŸ““
&lt;/h2&gt;

&lt;p&gt;It was painful to set up Meteor initially, but once we installed the app we were done for hurdles. Support for Windows is still a side thought, but it is not impossible to be a Windows Meteor Developer. However, I am not a fan of the snags we hit because of our choice of OS. As a developer, the less time I have to spend setting up and bootstrapping a project, the better. &lt;/p&gt;

&lt;p&gt;Deployment on Heroku is easy and convenient! Hopefully, the buildpack will be maintained for a while.&lt;/p&gt;

&lt;p&gt;I am a fan of these quick build frameworks that allow you to deliver quickly. I will be (cautiously) coming back to Meteor.&lt;/p&gt;

&lt;p&gt;Alternatively, if anyone knows frameworks that work similarly to Meteor, I am always looking to explore new ways to build stuff!&lt;/p&gt;

&lt;p&gt;While I have your attention, &lt;a href="https://emojipedia.org/imp/" rel="noopener noreferrer"&gt;look at the ðŸ‘¿ entry on EmojiPedia&lt;/a&gt;. Anything else that looks... Off?&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Now that Hacktoberfest is over, do you have anything to share?</title>
      <dc:creator>Sammy Israwi</dc:creator>
      <pubDate>Wed, 01 Nov 2017 14:07:33 +0000</pubDate>
      <link>https://dev.to/sammyisa/now-that-hacktoberfest-is-over-do-you-have-anything-to-share-394</link>
      <guid>https://dev.to/sammyisa/now-that-hacktoberfest-is-over-do-you-have-anything-to-share-394</guid>
      <description>&lt;p&gt;Hacktoberfest ðŸŽƒ just ended &lt;em&gt;yesterday&lt;/em&gt; and I'm willing to bet more than one person here has found a new pet project to work on their free time!&lt;/p&gt;

&lt;p&gt;Or, if you're like me, rushed a &lt;a href="https://github.com/SammyIsra/fred/pull/19"&gt;PR that added weather capabilities to a Hubot repo you manage for your friends Slack&lt;/a&gt; two hours before midnight to get that beautiful shirt.&lt;/p&gt;

&lt;p&gt;I also found out that not all PRs are going to be well received, and that I should be ready to get some rough feedback on my code if I deserve it. &lt;/p&gt;

&lt;p&gt;We all have good and bad stories here about Hacktoberfest so, share away!&lt;/p&gt;

&lt;p&gt;Also, while I'm at it, I'm always up to check out repos that do cool stuff in vanilla JS, React, and RxJS. So if you worked on one, I would like to see! ðŸš€&lt;/p&gt;

&lt;p&gt;Also, while I have your attention, take a look at the &lt;a href="https://emojipedia.org/crocodile/"&gt;Crocodile emoji entry on emojipedia&lt;/a&gt;. &lt;/p&gt;

</description>
      <category>github</category>
      <category>hacktoberfest</category>
      <category>discuss</category>
    </item>
    <item>
      <title>RxJS in practice: how to make a typeahead with streams!</title>
      <dc:creator>Sammy Israwi</dc:creator>
      <pubDate>Sat, 19 Aug 2017 18:42:17 +0000</pubDate>
      <link>https://dev.to/sammyisa/rxjs-in-practice-how-to-make-a-typeahead-with-streams</link>
      <guid>https://dev.to/sammyisa/rxjs-in-practice-how-to-make-a-typeahead-with-streams</guid>
      <description>&lt;h2&gt;
  
  
  What we will do
&lt;/h2&gt;

&lt;p&gt;You know when you type into the Twitter search bar and it tries to guess what you want to search for? Say you start typing "SammyI" and the first result is my twitter handle, &lt;a href="https://twitter.com/SammyIs_Me"&gt;@SammyIs_Me&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;That's what we'll make (except probably maybe not for Twitter).&lt;/p&gt;

&lt;h4&gt;
  
  
  But first, housekeeping
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://dev.to/sammyisa/what-is-rxjs-when-seen-from-a-mile-away"&gt;Last time&lt;/a&gt; we talked about streams and actions we do on those streams, but I did not use the correct terminology there. The streams are called Observables, and I will refer to those as such in the future. &lt;/p&gt;

&lt;h2&gt;
  
  
  Starting code
&lt;/h2&gt;

&lt;p&gt;Let's skip the basic HTML, just make something like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; 
       &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"typeahead"&lt;/span&gt; 
       &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"typeaheadInput"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can add some CSS to make it look nicer if you want. Next, the starting Javascript - a &lt;del&gt;stream&lt;/del&gt; observable that sends new data at every change of the input text box, and a function that logs the input to the console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;inputStream$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Rx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Observable&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fromEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;inputStream$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are even 'sanitizing' the observable to only get the useful data from the event.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting the search data
&lt;/h2&gt;

&lt;p&gt;To get the search/suggestion data, we will use &lt;a href="https://api.datamuse.com"&gt;Datamuse API&lt;/a&gt;. We will use the suggestion endpoint to get some word suggestions, like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET https://api.datamuse.com/sug?s=sammy
Response:
[{"word":"sammy","score":35841},
{"word":"sammy sosa","score":35639}, 
... ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's add that the request to our &lt;code&gt;subscribe&lt;/code&gt; of our observable, and we have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;inputStream$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://api.datamuse.com/sug?s=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we are showing to the console an array of all the suggestions from the API. We are not done, but you can see the final product from here! &lt;/p&gt;

&lt;h2&gt;
  
  
  Making the search data also an observable
&lt;/h2&gt;

&lt;p&gt;We continuously getting a stream of data from datamuse, can't we just make that another stream to be consumed? Yes we can!&lt;/p&gt;

&lt;p&gt;There are a few new, important concepts in this section to tackle, so make sure you get a good grasp on it before moving on.&lt;/p&gt;

&lt;p&gt;First, we don't want to hit the datamuse endpoint &lt;em&gt;at every single stroke&lt;/em&gt;. If we do, we will be getting recommendations for &lt;code&gt;h&lt;/code&gt;, &lt;code&gt;he&lt;/code&gt;, &lt;code&gt;hel&lt;/code&gt;, &lt;code&gt;hell&lt;/code&gt;, &lt;code&gt;hello&lt;/code&gt; and we only need the recommendations for the &lt;code&gt;hello&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;So, we will &lt;strong&gt;debounce&lt;/strong&gt; the observable. Debouncing means 'wait until we haven't received a new event on the stream for x milliseconds, then get the latest item and that's the new item of the observable. So, in our example from before, after we stop typing for one second, only &lt;code&gt;hello&lt;/code&gt; will be sent to the observable. Try it out, change the &lt;code&gt;inputStream$&lt;/code&gt; observable from before:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;inputStream$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Rx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Observable&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fromEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;debounceTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Type on the input box and then wait for two seconds. Keep an eye on the console.&lt;/p&gt;

&lt;p&gt;Let's make the search results a new observable!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;suggestionsStream$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;inputStream$&lt;/span&gt;
    &lt;span class="c1"&gt;//Fetch the data&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mergeMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://api.datamuse.com/sug?s=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;//Get the response body as a json&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mergeMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;//Get the data we want from the body&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;wordList&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;wordList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;I promise I will get into &lt;code&gt;mergeMap&lt;/code&gt; soon, but first I must ask you to just trust in it. If you are dealing with a promises, use &lt;code&gt;mergeMap&lt;/code&gt; instead of &lt;code&gt;map&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
Now that we have an observable that gives us an array of suggestions, we put that array somewhere. &lt;/p&gt;

&lt;p&gt;Since this is getting a bit longer than I anticipated, we will just list the suggestions in a div somewhere:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//We made a div of class 'suggestion' for this&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;suggestions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.suggestions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;suggestionsStream$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;words&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;suggestions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;words&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now try it out! Type something, wait two seconds, look at the results!&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; 
    &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"typeahead"&lt;/span&gt; 
    &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"typeaheadInput"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"suggestions"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
&lt;span class="c1"&gt;//Get the suggestions div&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;suggestions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.suggestions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;//Get the input component&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.typeaheadInput&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;//Input stream&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;inputStream$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Rx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Observable&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fromEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;debounceTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;//Suggestions stream&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;suggestionsStream$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;inputStream$&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mergeMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://api.datamuse.com/sug?s=&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mergeMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;//Handle the stream&lt;/span&gt;
&lt;span class="nx"&gt;suggestionsStream$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;words&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;suggestions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;words&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next time we will explain what &lt;code&gt;mergeMap&lt;/code&gt; is (probably a shorter one, it is so much more than a promise handler!) and we will dive into animations with RxJS! If you have any questions/corrections/suggestions/compliments you can reach me via Twitter &lt;a href="https://twitter.com/SammyIs_Me"&gt;@SammyIs_Me&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>rxjs</category>
      <category>tutorials</category>
    </item>
    <item>
      <title>What is RxJS when seen from a mile away?</title>
      <dc:creator>Sammy Israwi</dc:creator>
      <pubDate>Tue, 15 Aug 2017 08:23:18 +0000</pubDate>
      <link>https://dev.to/sammyisa/what-is-rxjs-when-seen-from-a-mile-away</link>
      <guid>https://dev.to/sammyisa/what-is-rxjs-when-seen-from-a-mile-away</guid>
      <description>

&lt;p&gt;Say I move my mouse on a website and every location in the path is collected and stored in an array. By the end of the visit, you have a huge array with the entire path my mouse took while I was visiting your website. &lt;/p&gt;

&lt;p&gt;Now let's say that I have access to that data in real time, as the mouse is moving across the screen. You can see this information as a &lt;em&gt;stream&lt;/em&gt; of data that at any given time, it tells you where my mouse is. &lt;/p&gt;

&lt;p&gt;Now that have access to a &lt;em&gt;stream&lt;/em&gt; of data, we just need to do something to &lt;em&gt;react&lt;/em&gt; to this stream (aka, do something every time a new mouse movement is recorded).&lt;/p&gt;

&lt;p&gt;To keep this simple, we will just log to the screen what the X and Y coordinates of the mouse are on the website.&lt;/p&gt;

&lt;p&gt;In RxJS, it looks something like this:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//The *stream*&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mouseMovement$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Rx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Observable&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fromEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'mousemove'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;//The *do something with it*&lt;/span&gt;
&lt;span class="nx"&gt;mouseMovement$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`(&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cilentX&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cilentY&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Great! But... can't we just do this with event handlers?&lt;/p&gt;

&lt;p&gt;Well...&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'mousemove'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`(&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientX&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientY&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;)`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In this simple case, yeah - and it's quite simple too... But then what if we want to modify the information before we handle it:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//I want the distance from the center of the page&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mouseMovement$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Rx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Observable&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fromEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'mousemove'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;posX&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientX&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientWidth&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;posY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientY&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientHeight&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;posX&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;posX&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;posY&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;posY&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="c1"&gt;//The *do something with it*&lt;/span&gt;
&lt;span class="nx"&gt;mouseMovement$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Radius: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Or want to limit how often we get information from the stream:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//I want to know where the mouse pointer is 2.5 seconds and not more often than that&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mouseMovement$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Rx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Observable&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fromEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'mousemove'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;debounceTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2500&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;//The *do something with it*&lt;/span&gt;
&lt;span class="nx"&gt;mouseMovement$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`(&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cilentX&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;position&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cilentY&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;RxJS makes is easy to do actions &lt;em&gt;over time&lt;/em&gt; over the information we get at different points in time. When we see everything as a stream of data we want to do something with over time, RxJS starts to make more and more sense. &lt;/p&gt;

&lt;p&gt;In my next post, we will make a typeahead using RxJS! Since I am writing this as I am learning it, the post will be with some mistakes I make in the process. &lt;em&gt;&lt;a href="https://dev.to/sammyisa/rxjs-in-practice-how-to-make-a-typeahead-with-streams"&gt;Oh hey here is the post!&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Thank you &lt;a href="https://twitter.com/toolsday"&gt;Toolsday&lt;/a&gt; podcast for the inspiration and &lt;a href="https://twitter.com/DavidKPiano"&gt;davidkpiano&lt;/a&gt; for the help!&lt;/em&gt;&lt;/p&gt;


</description>
      <category>javascript</category>
      <category>rxjs</category>
      <category>reactiveprogramming</category>
      <category>learning</category>
    </item>
    <item>
      <title>Hello, I'm Sammy!</title>
      <dc:creator>Sammy Israwi</dc:creator>
      <pubDate>Thu, 10 Aug 2017 18:35:54 +0000</pubDate>
      <link>https://dev.to/sammyisa/hello-im-sammy</link>
      <guid>https://dev.to/sammyisa/hello-im-sammy</guid>
      <description>&lt;p&gt;Hello! I'm Sammy. I'm a software developer currently at Precision Infinity in Orlando, FL.&lt;/p&gt;

&lt;p&gt;Most of what I enjoy is web development and design. I also do photography, you should check that out too!&lt;/p&gt;

</description>
      <category>introduction</category>
    </item>
  </channel>
</rss>
