<?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: yvesnrb</title>
    <description>The latest articles on DEV Community by yvesnrb (@yvesnrb).</description>
    <link>https://dev.to/yvesnrb</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%2F421053%2F5fdb92ea-0c9c-47e5-81ec-ace0933859d9.jpg</url>
      <title>DEV Community: yvesnrb</title>
      <link>https://dev.to/yvesnrb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yvesnrb"/>
    <language>en</language>
    <item>
      <title>HeatSat</title>
      <dc:creator>yvesnrb</dc:creator>
      <pubDate>Thu, 13 Jan 2022 20:58:29 +0000</pubDate>
      <link>https://dev.to/yvesnrb/heatsat-1nhm</link>
      <guid>https://dev.to/yvesnrb/heatsat-1nhm</guid>
      <description>&lt;h2&gt;
  
  
  HEATSAT
&lt;/h2&gt;

&lt;p&gt;Checkout the application live here: &lt;a href="https://heatsat.vercel.app/"&gt;HEATSAT&lt;/a&gt;. The site is not ready for mobile yet, so please try to view it on a desktop.&lt;/p&gt;

&lt;h3&gt;
  
  
  Overview of My Submission
&lt;/h3&gt;

&lt;p&gt;My submission is a web application that scrapes and parses heat satellite data from &lt;a href="https://queimadas.dgi.inpe.br/queimadas/dados-abertos/#"&gt;INPE&lt;/a&gt; and stores it in a time series database per region. A region can be any GeoJSON delimited block of land. Once a heat reading has been assigned to a region, it can be visualized on a map. You may also query a region to see how many heat readings it had this month, as well as if that is an increase from last month.&lt;/p&gt;

&lt;p&gt;New data comes in every 10 minutes - 24/7 and the application ingests about 200 to 300 heat readings each day! The MongoDB time series database feature was crucial in ensuring all of this data is queried quickly by timeframe and by region. This is because data is stored efficiently by region and by timestamp. You can learn more about time series databases &lt;a href="https://www.youtube.com/watch?v=xu2AkGVI37E"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here are a few feature demo gifs:&lt;/p&gt;

&lt;h4&gt;
  
  
  Browse heat data on a map.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5rhfWylf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ez60bk8dwrhp02eygbru.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5rhfWylf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ez60bk8dwrhp02eygbru.gif" alt="Brose heat data demo" width="880" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  List regions.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l0mQQuO9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n53x92bajp8c2vvhmg99.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l0mQQuO9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n53x92bajp8c2vvhmg99.gif" alt="List regions demo" width="880" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  View a region on a map, as well as its stats.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cmqJ-3Ka--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slf4jgy0u5i8qnj8ef96.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cmqJ-3Ka--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slf4jgy0u5i8qnj8ef96.gif" alt="View region demo" width="880" height="526"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;This project is under the Prime Time category.&lt;/p&gt;

&lt;h3&gt;
  
  
  Link to Code
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/yvesnrb"&gt;
        yvesnrb
      &lt;/a&gt; / &lt;a href="https://github.com/yvesnrb/heatsat"&gt;
        heatsat
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Track wildfire satellite data in South America. Atlas + Dev.to Hackaton 2021 project.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
HeatSat&lt;/h1&gt;
&lt;p&gt;More information soon.&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/yvesnrb/heatsat"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;Special thanks to:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://queimadas.dgi.inpe.br/queimadas/dados-abertos/#"&gt;INPE&lt;/a&gt;&lt;br&gt;
&lt;a href="https://tailwindcss.com/"&gt;TailwindCSS&lt;/a&gt;&lt;br&gt;
&lt;a href="https://nextjs.org/"&gt;NextJS&lt;/a&gt;&lt;br&gt;
&lt;a href="https://turfjs.org/"&gt;TurfJS&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/JustFly1984/react-google-maps-api"&gt;@react-google-maps/api&lt;/a&gt;&lt;/p&gt;

</description>
      <category>atlashackathon</category>
    </item>
    <item>
      <title>Understanding Immediately Invoked Function Expressions (IIFEs)</title>
      <dc:creator>yvesnrb</dc:creator>
      <pubDate>Thu, 25 Nov 2021 17:18:42 +0000</pubDate>
      <link>https://dev.to/yvesnrb/understanding-immediately-invoked-function-expressions-iifes-1mob</link>
      <guid>https://dev.to/yvesnrb/understanding-immediately-invoked-function-expressions-iifes-1mob</guid>
      <description>&lt;p&gt;An immediately invoked function expression - often abbreviated to IIFE and pronounced 'iffy' - is a very powerful and useful construct in JavaScript.&lt;/p&gt;

&lt;p&gt;You've probably already came across something that looks 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="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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, world&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;A function that is defined and then immediately executed is a fairly simple concept, but how does it actually work? Why would you use it? Whats with all of the parentheses?&lt;/p&gt;

&lt;p&gt;Let's go through a few basic concepts and understand how the JS engine parses this code block.&lt;/p&gt;

&lt;h2&gt;
  
  
  Statements vs. Expressions
&lt;/h2&gt;

&lt;p&gt;First, it is important we understand the difference between a statement and an expression.&lt;/p&gt;

&lt;p&gt;A &lt;em&gt;statement&lt;/em&gt; is simply a stand alone unit of execution which does some type of work. A simple example is the &lt;code&gt;if&lt;/code&gt; statement, which will execute the code defined in its block if a condition is &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In contrast, an &lt;em&gt;expression&lt;/em&gt; is a unit of execution which can also perform some type of work but will then be reduced (or evaluated) to a value. For example the expression &lt;code&gt;3 &amp;gt; 2&lt;/code&gt; will compare the two values, and then be evaluated to the value &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is important because in JS, a function can be either a statement or an expression. A function statement looks 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="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;greet&lt;/span&gt;&lt;span class="p"&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, world&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;When the JS engine interprets this snippet, it will allocate space in memory for this function and create a name - &lt;code&gt;greet&lt;/code&gt; - which points to said space in memory. One can then execute, or invoke, this function by appending the name with a pair of parenthesis: &lt;code&gt;greet()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On the other hand, a function expression looks 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="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;greet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, world&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;Here, the JS engine will first allocate a space in memory for the variable &lt;code&gt;greet&lt;/code&gt; and set it to &lt;code&gt;undefined&lt;/code&gt;. Then, at the moment it evaluates the function expression, it will create an object and set it up with the code inside of the function body. Finally, it will evaluate the assignment expression using both operands of the assignment operator (&lt;code&gt;=&lt;/code&gt;) - that is the object and the variable. The assignment expression results in the &lt;code&gt;greet&lt;/code&gt; variable pointing to the address in memory of the previously created object.&lt;/p&gt;

&lt;p&gt;You might be confused by the use of the word "object" here. Indeed, in JS a function is actually a special type of object. Function objects have a special property called &lt;code&gt;[[Code]]&lt;/code&gt; which holds the actual body of the function. When we append a pair of parenthesis to a name as in &lt;code&gt;greet()&lt;/code&gt; the engine simply looks for the property and executes it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Immediate Function Execution
&lt;/h2&gt;

&lt;p&gt;Executing a function expression doesn't have to take place after its assignment to a variable. We can append a pair of parenthesis right after the expression which evaluates to it and execute it right then and there:&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;greet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, world&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;This is indeed an IIFE. If you execute this snippet in a browser, you will see that the log happens right away. However, inspecting the variable &lt;code&gt;greet&lt;/code&gt; will tell you that it is set to &lt;code&gt;undefined&lt;/code&gt;. Shouldn't it hold the function object?&lt;/p&gt;

&lt;p&gt;To understand why that is, let's look at the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#table"&gt;operator precedence table on MDN&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This table describes the order in which operators will be evaluated. Operators with a higher number in the 'precedence' column will be evaluated before the ones with a lower number.&lt;/p&gt;

&lt;p&gt;If we look for the precedence value of the assignment operator (&lt;code&gt;=&lt;/code&gt;) we will find that it is 2. And if we look for the value of the function call operator (&lt;code&gt;...()&lt;/code&gt;) we will see that it is 18, a much higher number.&lt;/p&gt;

&lt;p&gt;Therefore, the order in which the engine will interpret the snippet is:&lt;/p&gt;

&lt;p&gt;1) Allocate an address in memory with the name &lt;code&gt;greet&lt;/code&gt; and set it to &lt;code&gt;undefined&lt;/code&gt;.&lt;br&gt;
2) Evaluate the function expression to create a function object.&lt;br&gt;
3) Execute the function. Since the function has no explicit return value, this expression evaluates to &lt;code&gt;undefined&lt;/code&gt;.&lt;br&gt;
4) Finally assign the result of the last evaluation to the variable &lt;code&gt;greet&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Naturally, if the function had an explicit return value we would have ended up assigning that to the variable:&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;greet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, world&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;This is in fact an IIFE, just not its most popular form. What you probably want to do is have a stand alone function expression and then execute it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stand Alone Expressions
&lt;/h2&gt;

&lt;p&gt;The JS engine does not mind interpreting useless expressions which never get used anywhere:&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="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// number expression&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I'm a string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;// string expression&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;object literal&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// object literal expression&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All of the above expressions will be evaluated into their literal values and then immediately thrown away. If you execute the above in a browser you will see that no error is thrown. However, if you try to do the same for a function expression:&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;function&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="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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&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;The engine will throw a syntax error with the message of "Function statements require a function name. But wait, did&lt;br&gt;
it just say "statement"?&lt;/p&gt;

&lt;p&gt;Indeed, the difference between a function statement and a function expression is not whether or not we name the function after the keyword &lt;code&gt;function&lt;/code&gt;, but rather where it sits lexically in our code.&lt;/p&gt;

&lt;p&gt;When we declare a function as an operand of the assignment operator &lt;code&gt;=&lt;/code&gt;, the engine knows to evaluate it as an expression. When we declare a function as a parameter of another function or object method, the engine also knows to&lt;br&gt;
evaluate it as an expression. Finally, when we declare a function stand-alone, it will be interpreted by the engine as a statement and it will expect a name or throw an exception.&lt;/p&gt;

&lt;p&gt;To actually create a stand alone function expression, we have to trick the syntax parser into interpreting it as an expression. There is actually a few different ways to do this, but the most popular way is to wrap the function in parentheses:&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="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&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="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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&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;The outer set of parenthesis here are the 'grouping operator'. If you refer to the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Grouping"&gt;MDN documentation&lt;/a&gt; on them you will learn it controls the precedence of evaluation in expressions. As in, it expects everything contained withing it to be an expression. Thus, we've created a stand alone function expression.&lt;/p&gt;

&lt;p&gt;Once again, we can execute the expression immediately after its evaluation into an object by appending it with another set of parenthesis:&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="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&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="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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&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;This time, the parenthesis are the "function call" operator. Thus, a pair of parenthesis can be three different things depending on where it sits lexically in our code: the grouping operator if its stand alone, the function call operator if it is appended to a name or an argument list when its after the &lt;code&gt;function&lt;/code&gt; keyword.&lt;/p&gt;

&lt;p&gt;With the introduction of arrow functions in ES6, the most popular way of declaring an IIFE is with them:&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="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="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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&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;An arrow function is simply a function expression with no binds for the &lt;code&gt;this&lt;/code&gt; or &lt;code&gt;super&lt;/code&gt; keywords. A topic for another post.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Though?
&lt;/h2&gt;

&lt;p&gt;How are IIFEs useful? There are a few different uses for them. There first one is as a bypass to the rule that you can't use async/await in the top level of your code:&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="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&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="c1"&gt;// fetch some data or do some other async thing here&lt;/span&gt;
&lt;span class="p"&gt;})();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second one is to avoid polluting the global namespace with variables which we will only use once during the initial phase of our script:&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="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="c1"&gt;// some initiation code&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;firstVariable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;secondVariable&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;})();&lt;/span&gt;

&lt;span class="c1"&gt;// firstVariable and secondVariable will be discarded after the function is executed.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;That is all. I hope you've learned as much about IIFEs reading this post as I did writing it!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>DO Hackaton Submission</title>
      <dc:creator>yvesnrb</dc:creator>
      <pubDate>Sun, 10 Jan 2021 01:46:19 +0000</pubDate>
      <link>https://dev.to/yvesnrb/do-hackaton-submission-20nh</link>
      <guid>https://dev.to/yvesnrb/do-hackaton-submission-20nh</guid>
      <description>&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;Dbug is an application where programmers can connect with each other for pair programming.&lt;/p&gt;

&lt;h3&gt;
  
  
  Category Submission:
&lt;/h3&gt;

&lt;p&gt;Program for the People&lt;/p&gt;

&lt;h3&gt;
  
  
  App Link
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dbug.xyz/"&gt;dbug.xyz&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Screenshots
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Edit your contact information
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tNI9IHKm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1zb4bsyn94mt4egyqv4h.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tNI9IHKm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1zb4bsyn94mt4egyqv4h.gif" alt="Contact change demo video"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Add a new project
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TsE1UySF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/txgreeus4c89o5a1hevz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TsE1UySF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/txgreeus4c89o5a1hevz.gif" alt="New project demo video"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Share your contact information
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QhKgCis1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ttbkz6ngs73ibsizeqlj.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QhKgCis1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ttbkz6ngs73ibsizeqlj.gif" alt="Share your contact demo video"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Receive and select contact offers
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fC5wS5g8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/59v983gv1wg8civqtpq5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fC5wS5g8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/59v983gv1wg8civqtpq5.gif" alt="Contact selection demo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Description
&lt;/h3&gt;

&lt;p&gt;This application allows people to save their contact information and share it with other users. The information stays private and is only shared with people that you decide to share it with. Once you create a project you can receive multiple contact offerings and see on what platforms they are available, as well as GitHub statistics for their profile. After selecting a contact, you are given their contact information for further contact.&lt;/p&gt;

&lt;h3&gt;
  
  
  Link to Source Code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/yvesnrb/dbug"&gt;https://github.com/yvesnrb/dbug&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Permissive License
&lt;/h3&gt;

&lt;p&gt;MIT&lt;/p&gt;

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

&lt;p&gt;I wanted to build this app because I think opportunities to bring people together safely is invaluable today. I hope I can give people the opportunity to video call each other to help solve problems and build cool stuff.&lt;/p&gt;

&lt;h3&gt;
  
  
  How I built it
&lt;/h3&gt;

&lt;p&gt;This application is composed of a full TypeScript stack. I've used ReactJS for the front-end and Express and TypeORM on the back-end. Additionally the application interfaces with a PostgreSQL database. Digital Ocean's App Platform made it extremely easy to get the entire stack running and to deploy new iterations of my application for other people to try.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Resources/Info
&lt;/h3&gt;

&lt;p&gt;Check out the other posts in this series for some additional insight on how I've built this application.&lt;/p&gt;

</description>
      <category>dohackathon</category>
    </item>
    <item>
      <title>DO Hackaton Log #4</title>
      <dc:creator>yvesnrb</dc:creator>
      <pubDate>Fri, 08 Jan 2021 16:12:50 +0000</pubDate>
      <link>https://dev.to/yvesnrb/do-hackaton-log-4-163c</link>
      <guid>https://dev.to/yvesnrb/do-hackaton-log-4-163c</guid>
      <description>&lt;p&gt;Hi devs,&lt;/p&gt;

&lt;p&gt;My appllication is finally ready! You can go to &lt;a href="https://dbug.xyz" rel="noopener noreferrer"&gt;this link&lt;/a&gt; right now to try it out. In case you haven't read the last posts, dbug is an application where programmers can post short project ideas or problems they are trying to solve and other programmers can offer their contact information for pair programming. Here is a demo of the features:&lt;/p&gt;

&lt;h3&gt;
  
  
  Edit your contact information
&lt;/h3&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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1zb4bsyn94mt4egyqv4h.gif" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1zb4bsyn94mt4egyqv4h.gif" alt="Contact change demo video"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is required to have at least one of any contact information available (meet, discord or zoom). This information is not public and only gets sent to the author of projects you decide to share your contact with.&lt;/p&gt;

&lt;h3&gt;
  
  
  Add a new project
&lt;/h3&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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftxgreeus4c89o5a1hevz.gif" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftxgreeus4c89o5a1hevz.gif" alt="New project demo video"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You may only have one active project at once. The projects stay up indefinitely until you either delete it or choose a contact offer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Share your contact information
&lt;/h3&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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fttbkz6ngs73ibsizeqlj.gif" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fttbkz6ngs73ibsizeqlj.gif" alt="Share your contact demo video"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can do this on as many projects as you want, it does not guarantee that the author of that project will be able to contact you as they may select some other contact offer. Also the project list has an infinite scroll feature.&lt;/p&gt;

&lt;h3&gt;
  
  
  Receive and select contact offers
&lt;/h3&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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F59v983gv1wg8civqtpq5.gif" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F59v983gv1wg8civqtpq5.gif" alt="Contact selection demo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;New contact offers will show up on the project page. Once you select one, you are taken to a screen were you can see all of the contact information that was made available by that user. This will also close that project.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I've learned
&lt;/h3&gt;

&lt;p&gt;Building this submission has given me the opportunity to learn a lot of new technologies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TypeORM&lt;/strong&gt;
I had already worked with TypeORM before but in a much simpler capacity. Now I know a lot more about relations and queries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;react-query&lt;/strong&gt;
This I had never used before, it took a while for me to figure out how this library is supposed to be used and I considered giving up on it and just doing the axios requests manually but I'm glad I didn't, this tool is a huge time saver and makes querying an API a hundred times easier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storybook&lt;/strong&gt;
Also had used before but only on a very surface level. You can read my other post on this series if you want to know more about Storybook it is a great took for front-end work.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Finalizing
&lt;/h3&gt;

&lt;p&gt;Now I just need to write some readme files before making my submission. I hope you all had as much fun as I did in this hackaton!&lt;/p&gt;

</description>
      <category>dohackathon</category>
      <category>react</category>
      <category>typescript</category>
      <category>node</category>
    </item>
    <item>
      <title>DO Hackaton Log #3</title>
      <dc:creator>yvesnrb</dc:creator>
      <pubDate>Wed, 23 Dec 2020 22:54:57 +0000</pubDate>
      <link>https://dev.to/yvesnrb/do-hackaton-log-3-2l39</link>
      <guid>https://dev.to/yvesnrb/do-hackaton-log-3-2l39</guid>
      <description>&lt;p&gt;Hi devs,&lt;/p&gt;

&lt;p&gt;My latest addition to my hackaton project has been the implementation of user authentication through the GitHub OAuth API. Users can now start a session with their accounts to gain access to restricted pages and also destroy their sessions and sign out.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fln9gfkcdyqbot8m6xswg.gif" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fln9gfkcdyqbot8m6xswg.gif" alt="Sign in demo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The way it works is quite simple: when we register an OAuth application with GitHub we can generate a link that will show the authorization screen, we can also set a callback URL that GitHub will redirect to after the user accepts. When the user is redirected, GitHub adds a code to a query parameter of our callback URL. This code is sent to my application server where it can be traded for a token. Since the scope of my application is empty, this token can only really be used to read publicly available data on the user that tried to sign in, but if our application had more in-depth integration with GitHub's services we could add other things to the scope and take actions on behalf of the user, such as creating repos, commenting on issues etc. After the application reads the user data it checks to see if that user already exists in our database, if it doesn't it creates a new one, if it does it simply updates that user's information. The server can finally emit a JWT for that user and return it with some session information.&lt;/p&gt;

&lt;p&gt;On the front end side of things, I am using the context API to keep session information and persisting it trough the browsers local storage (I realize this isn't the end-all solution for JWT safe-keeping but it will be improved upon later).&lt;/p&gt;

&lt;p&gt;I'd love it if you gave it a try at &lt;a href="https://dbug.xyz/" rel="noopener noreferrer"&gt;this link&lt;/a&gt; and let me know what you think.&lt;/p&gt;

&lt;p&gt;Have a great hackaton!&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/yvesnrb" rel="noopener noreferrer"&gt;
        yvesnrb
      &lt;/a&gt; / &lt;a href="https://github.com/yvesnrb/dbug" rel="noopener noreferrer"&gt;
        dbug
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Use dbug to find people to pair program using your favorite communication platforms.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>dohackathon</category>
      <category>react</category>
      <category>typescript</category>
      <category>node</category>
    </item>
    <item>
      <title>DO Hackaton Log #2</title>
      <dc:creator>yvesnrb</dc:creator>
      <pubDate>Sun, 20 Dec 2020 03:39:06 +0000</pubDate>
      <link>https://dev.to/yvesnrb/do-hackaton-log-2-1o5n</link>
      <guid>https://dev.to/yvesnrb/do-hackaton-log-2-1o5n</guid>
      <description>&lt;p&gt;Hello devs,&lt;/p&gt;

&lt;p&gt;My latest push on the hackaton project has been to implement Storybook and create all of the UI components on the front-end package.&lt;/p&gt;

&lt;h3&gt;
  
  
  Storybook
&lt;/h3&gt;

&lt;p&gt;If you don't know what Storybook is, you are seriously missing out! It is a tool where you can organize all of the components of an application in 'stories'. Each story of a component is a way in which it can be used, so you can have the different variations of a button component for example. It is also a great place to work on your components since it implements hot reloading and you don't have to worry about placing your components in a dummy page to work on them.&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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fthgpa9jofhaws616uvim.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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fthgpa9jofhaws616uvim.png" alt="Storybook Manager Panel"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The controls you see on the right of the page are all built automatically by inferring from typescript interfaces. The 'color' radio buttons come from &lt;code&gt;color: 'primary' | 'secondary'&lt;/code&gt; and the toggles are all boolean props. It will  even generate documentation:&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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgagzv5ig43fzyiyroh2k.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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgagzv5ig43fzyiyroh2k.png" alt="Storybook Docs Page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are writing your React components with Typescript, Storybook will do all of that on its own, no extra configuration necessary.&lt;/p&gt;

&lt;p&gt;What you do have to do is write the stories, but that is super easy, here is the stories file for my button component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&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;react&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;Story&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Meta&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;@storybook/react/types-6-0&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="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;ButtonProps&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;./index&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;component&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;parameters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;layout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;centered&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="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Meta&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;Template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Story&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ButtonProps&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="p"&gt;{...&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Primary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Template&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;({});&lt;/span&gt;
&lt;span class="nx"&gt;Primary&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Im a button!&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Disabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Template&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;({});&lt;/span&gt;
&lt;span class="nx"&gt;Disabled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;disabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Im a button!&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Secondary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Template&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;({});&lt;/span&gt;
&lt;span class="nx"&gt;Secondary&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;secondary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Im a button!&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Small&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Template&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;({});&lt;/span&gt;
&lt;span class="nx"&gt;Small&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;small&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Im a button!&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Loading&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Template&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;({});&lt;/span&gt;
&lt;span class="nx"&gt;Loading&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;loading&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Im a button!&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;The gist of it is this: the default export of this file is an object with metadata about all of the stories relating to this component, here you can define the display name of the component, how storybook will display it on the screen and (much, much) more. Then we define a template, this is a function that will be used to render all of the stories. All we need to do then is export the stories themselves, by describing what the props for that story will be in the 'args' object.&lt;/p&gt;

&lt;p&gt;This barely scratches the surface, some features of Storybook include the ability to replace the imports of a component with mock versions for testing, decorators, MDX pages for writing documentation and an add-on API for extending the entire thing.&lt;/p&gt;

&lt;p&gt;Storybook is not just for React, it supports a long list of frameworks and libraries, including the big three you would expect and several more. I hope you will give it a try in the future because it has helped me quite a bit with front-end work.&lt;/p&gt;
&lt;h3&gt;
  
  
  UI Components
&lt;/h3&gt;

&lt;p&gt;The UI components I've build so far are fairly boring stuff, buttons, inputs and spinners. If you want to check it out you can clone the repo and run these:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn
yarn workspace @dbug/web storybook
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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/yvesnrb" rel="noopener noreferrer"&gt;
        yvesnrb
      &lt;/a&gt; / &lt;a href="https://github.com/yvesnrb/dbug" rel="noopener noreferrer"&gt;
        dbug
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Use dbug to find people to pair program using your favorite communication platforms.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;Have a great hackaton!&lt;/p&gt;

</description>
      <category>dohackathon</category>
      <category>react</category>
      <category>typescript</category>
      <category>node</category>
    </item>
    <item>
      <title>DO Hackaton Log #1</title>
      <dc:creator>yvesnrb</dc:creator>
      <pubDate>Wed, 16 Dec 2020 01:00:01 +0000</pubDate>
      <link>https://dev.to/yvesnrb/do-hackaton-log-day-1-57eg</link>
      <guid>https://dev.to/yvesnrb/do-hackaton-log-day-1-57eg</guid>
      <description>&lt;p&gt;I'm late!&lt;/p&gt;

&lt;p&gt;No problem, my project is going to be super simple for this year: my idea is for an application where programmers can post short project ideas or problems they are trying to solve and other programmers can offer their contact information for pair programming. I'm calling it dbug for now (accepting suggestions).&lt;/p&gt;

&lt;p&gt;I will be using a full typescript stack with ReactJS on the front-end and Node in the server. I will also use the amazing TypeORM to interact with a PostgreSQL database.&lt;/p&gt;

&lt;h3&gt;
  
  
  Figma Prototype and Use Cases
&lt;/h3&gt;

&lt;p&gt;First order of the day was coming up with some Figma screens. You can check out what I've come up with here:&lt;br&gt;
&lt;a href="https://www.figma.com/file/1ZiEK5DqBoDa1mW3DgA85X/dbug?node-id=0%3A1"&gt;Figma Prototype&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Drawing the screens on Figma really helps me solidify the functionalities I want to get out of an application. We are trying to keep it lean for this one, users will only be capable of offering their information to other people's projects, posting their own project and selecting an applicant to their project to pair program with. Other than saving and updating their contact information (zoom, meet and discord for now) this is pretty much it. I'm also delegating all user authentication to GitHub's OAuth API, this should give me access to a lot of useful user information like avatars, bios and stars while adding very little overhead to the application.&lt;/p&gt;

&lt;p&gt;Other things are in the back of my mind too, such as tagging and searching listings by technology and a place to store and retrieve previous contacts. I'll complete this MVP first and see how much time I have left to add on to it.&lt;/p&gt;
&lt;h3&gt;
  
  
  GitHub Monorepo Setup
&lt;/h3&gt;

&lt;p&gt;I've been hearing a lot about the idea of monorepos lately so I've decided I'd give this a try for this project. Using yarn's workspace feature I've defined two packages: @dbug/server and @dbug/web. @dbug/server was scaffolded with a simple Express hello world thing, and the necessary scripts for transpiling the typescript into a /dist folder. I also ran trough some simple configuration for Eslint and Prettier, using the popular Airbnb style guide. @dbug/web was scaffolded with create-react-app using the typescript template, I've also ran trough a similar configuration for Eslint and Prettier.&lt;/p&gt;

&lt;p&gt;It's not a lot, but it will do for setting up the next part: the Digital Ocean App platform. You can check out the repository here:&lt;br&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://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/yvesnrb"&gt;
        yvesnrb
      &lt;/a&gt; / &lt;a href="https://github.com/yvesnrb/dbug"&gt;
        dbug
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Use dbug to find people to pair program using your favorite communication platforms.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Digital Ocean App Platform Setup
&lt;/h3&gt;

&lt;p&gt;My experience deploying this application to DO's Apps has been super pleasant. All you need to do is fill a few forms and your application gets built and deployed!&lt;/p&gt;

&lt;p&gt;The first thing you need to do is select what repository you will be deploying from:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qllthb3p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/nw81tdvgc7e5yd3t8o39.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qllthb3p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/nw81tdvgc7e5yd3t8o39.png" alt="Repository Selection"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then it will prompt you for the region of the datacenter you want your application to live in as well as the branch that it will pull the code from.&lt;/p&gt;

&lt;p&gt;The next step is to set up environment variables and build commands:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qf2EHyw4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1riw6ztsn9ufapaqb9al.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qf2EHyw4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1riw6ztsn9ufapaqb9al.png" alt="Further Setup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see it already recognized we are trying to deploy a node application. For environment variables we only need one for now: APP_PORT that I'll set up with the value of 8080. My build command for the @dbug/server package is this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn workspace @dbug/server build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We also need a run command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn workspace @dbug/server start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The HTTP routes field lets you setup a url path in which this component will live, I've set it to '/api' so our server will be reachable on [base_url]/api. At the very bottom you will see 'HTTP Port'. This is the port that will be forwarded to the external 80 port out of the Docker container (this whole thing is built with Docker, you can even upload you own Docker files to get fine grain tuning).&lt;/p&gt;

&lt;p&gt;The final thing you need to do before launching is selecting your plan and you are live!&lt;/p&gt;

&lt;p&gt;Another 'component' you can have on DO's App is a static site. The setup is very similar except you don't really need a run command, all you need is the build command and the path where the final static files of the site can be found. DO will then upload the static files to its spaces platform and serve them as you would expect. Also, SSL certificates are all handled for you!&lt;/p&gt;

&lt;p&gt;You can check out my progress on &lt;a href="https://dbug.xyz/"&gt;dbug.xyz&lt;/a&gt;. It isn't much for now but should grow in time.&lt;/p&gt;

&lt;p&gt;I'd love to see some feedback and suggestions, have a great hackaton!&lt;/p&gt;

</description>
      <category>dohackathon</category>
      <category>react</category>
      <category>typescript</category>
      <category>node</category>
    </item>
  </channel>
</rss>
