<?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: lorrydriveloper</title>
    <description>The latest articles on DEV Community by lorrydriveloper (@lorrydriveloper).</description>
    <link>https://dev.to/lorrydriveloper</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%2F210769%2Fb60152e3-f982-41be-ab51-3c9cafe1a7a5.jpg</url>
      <title>DEV Community: lorrydriveloper</title>
      <link>https://dev.to/lorrydriveloper</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lorrydriveloper"/>
    <language>en</language>
    <item>
      <title>Solving the Challenge of Connecting Stimulus Controllers Inside Shadow DOM</title>
      <dc:creator>lorrydriveloper</dc:creator>
      <pubDate>Fri, 21 Jun 2024 10:10:40 +0000</pubDate>
      <link>https://dev.to/lorrydriveloper/solving-the-challenge-of-connecting-stimulus-controllers-inside-shadow-dom-4160</link>
      <guid>https://dev.to/lorrydriveloper/solving-the-challenge-of-connecting-stimulus-controllers-inside-shadow-dom-4160</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;As web development evolves, combining powerful frameworks and technologies can lead to interesting challenges. Recently, I encountered such a challenge when trying to connect a Stimulus controller to an element within a Shadow DOM. After some troubleshooting, I found a solution and I’d like to share how I made it work.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Stimulus?
&lt;/h3&gt;

&lt;p&gt;Stimulus is a modest JavaScript framework designed to enhance static HTML by adding behaviors through controllers. It allows you to create controllers that connect JavaScript behavior to HTML elements using data attributes. Think of it as the "HTML first" approach, where you keep most of your application's state and behavior in the HTML.&lt;/p&gt;

&lt;p&gt;Here's a simple example of a Stimulus controller in action:&lt;/p&gt;

&lt;h3&gt;
  
  
  HTML
&lt;/h3&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;data-controller=&lt;/span&gt;&lt;span class="s"&gt;"hello"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;data-action=&lt;/span&gt;&lt;span class="s"&gt;"click-&amp;gt;hello#greet"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Click me&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  JavaScript
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// hello_controller.js&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;Controller&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;@hotwired/stimulus&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;Controller&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, Stimulus!&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="c1"&gt;// application.js&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;Application&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;@hotwired/stimulus&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;HelloController&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;./hello_controller&lt;/span&gt;&lt;span class="dl"&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;application&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;HelloController&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Key Concepts of Stimulus
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Data Attributes&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;data-controller&lt;/code&gt;: Specifies the controller name to attach to the element.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data-action&lt;/code&gt;: Specifies the event to listen for and the method to call. The format is &lt;code&gt;event-&amp;gt;controller#method&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Controller Methods&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Methods in the controller are called in response to events. In the example above, the &lt;code&gt;greet&lt;/code&gt; method is called when the button is clicked.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Target Elements&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can define target elements within your controller using the &lt;code&gt;data-target&lt;/code&gt; attribute and access them in your controller code.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For more information on Stimulus, you can refer to the &lt;a href="https://stimulus.hotwired.dev/"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Challenge: Integrating Stimulus with Shadow DOM
&lt;/h2&gt;

&lt;p&gt;When integrating Stimulus with Shadow DOM, the main challenge is that Stimulus typically operates within the light DOM. By default, it tries to get the element by a selector using &lt;code&gt;querySelector&lt;/code&gt; or another strategy, assuming the root is the HTML unless specified otherwise.&lt;/p&gt;

&lt;p&gt;Here’s a simplified version of the problem:&lt;/p&gt;

&lt;h3&gt;
  
  
  HTML
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Other HTML --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;greeting-component&amp;gt;&lt;/span&gt;
  #shadow-dom
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"root"&lt;/span&gt; &lt;span class="na"&gt;data-controller=&lt;/span&gt;&lt;span class="s"&gt;"hello"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;data-action=&lt;/span&gt;&lt;span class="s"&gt;"click-&amp;gt;hello#greet"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Click me&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/greeting-component&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- Other HTML --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When Stimulus tries to find the element, it effectively runs &lt;code&gt;this.element.querySelectorAll(selector)&lt;/code&gt;. However, since the controller's selector is inside a Shadow DOM, it’s not visible from the top level, and thus, the controller never gets connected.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Solution
&lt;/h3&gt;

&lt;p&gt;The solution is to register the Stimulus application within your web component's Shadow DOM. Here’s how you can do it:&lt;/p&gt;

&lt;h3&gt;
  
  
  Web Component Definition
&lt;/h3&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;Application&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;@hotwired/stimulus&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;HelloController&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;./hello_controller&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GreetingComponent&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;HTMLElement&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;attachShadow&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;open&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="c1"&gt;// HTML structure of the shadow DOM&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;shadowRoot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`
      &amp;lt;div id="root" data-controller="hello"&amp;gt;
        &amp;lt;button data-action="click-&amp;gt;hello#greet"&amp;gt;Click me&amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;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;connectedCallback&lt;/span&gt;&lt;span class="p"&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;application&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;shadowRoot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#root&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="nx"&gt;application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;HelloController&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;customElements&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;define&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;greeting-component&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;GreetingComponent&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Explanation
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Import Dependencies&lt;/strong&gt;: We import the &lt;code&gt;Application&lt;/code&gt; from Stimulus and our custom controller.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Define the Web Component&lt;/strong&gt;: We create a class for our web component extending &lt;code&gt;HTMLElement&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;connectedCallback Lifecycle Hook&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;We start the Stimulus application within the Shadow DOM by querying the root element inside the Shadow DOM (&lt;code&gt;this.shadowRoot.querySelector("#root")&lt;/code&gt;). This is important as &lt;code&gt;this.shadowRoot&lt;/code&gt; itself is not a valid node for the Stimulus application.&lt;/li&gt;
&lt;li&gt;We then register our controller with the Stimulus application.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This approach ensures that the Stimulus controllers are connected to elements within the Shadow DOM, making them accessible and functional.&lt;/p&gt;

&lt;h3&gt;
  
  
  Considerations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The setup and lifecycle of your web component might affect how you access and manage the Stimulus application and controllers.&lt;/li&gt;
&lt;li&gt;Ensure that your custom elements are properly defined and attached to the DOM before trying to start the Stimulus application and register controllers.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Stimulus controllers are a powerful way to add behavior to your HTML in a clean, modular fashion. By understanding the basics of controllers, data attributes, actions, and targets, you can create interactive web applications. Integrating Stimulus with Shadow DOM requires some additional steps, but it allows you to leverage the benefits of both technologies effectively.&lt;/p&gt;

&lt;p&gt;I hope this solution helps you as much as it helped me. Feel free to share your experiences or any improvements you discover along the way!&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>javascript</category>
      <category>stimulus</category>
      <category>shadowdom</category>
    </item>
    <item>
      <title>Mastering Fundamentals</title>
      <dc:creator>lorrydriveloper</dc:creator>
      <pubDate>Wed, 09 Sep 2020 09:20:55 +0000</pubDate>
      <link>https://dev.to/lorrydriveloper/mastering-fundamentals-he3</link>
      <guid>https://dev.to/lorrydriveloper/mastering-fundamentals-he3</guid>
      <description>&lt;p&gt;I know this title can be a bit of click-bait, but this post is for references to myself as well to force me to dig more on the fundamentals of programming but wait...&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the Programming fundamentals?
&lt;/h2&gt;

&lt;p&gt;I know that this can be a silly question if you don't think deeply on it. I have been thinking about this for a while because the main advice for junior devs over and over is to learn and  Master fundamentals but, is there a clear view which the fundamentals are?&lt;/p&gt;

&lt;p&gt;What I mean is that the fundamentals in javascript are the same as the fundamentals in Python or C#. I don't think so, of course, they all have a lowest common denominator, and that is what I will try to achieve during this series of posts focused to those concepts that you may have a clear overall vision but do you understand them deeply?&lt;/p&gt;

&lt;h3&gt;
  
  
  What this series will focus?
&lt;/h3&gt;

&lt;p&gt;From my understanding and I'm more than happy to hear your opinions and talk about it, at the end this post is more about to learning than to teach so, please feel free to comments if you think my vision is incorrect.&lt;/p&gt;

&lt;p&gt;I will focus on the three languages I know Javascript, Python, and Ruby.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Variables and the difference between languages&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conditional code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Loops, what is happening underneath and its types.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Built Data types on each language.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Functions/Methods release all its power.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Programing Paradigms.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think this is more or less what all languages have in common, so I think those are the Programming Fundamentals.&lt;/p&gt;

&lt;p&gt;Are you Agree? Should I add, delete something? Please comment and help me to understand and structure this series for future references.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Flatiron Network</title>
      <dc:creator>lorrydriveloper</dc:creator>
      <pubDate>Thu, 02 Jul 2020 14:55:28 +0000</pubDate>
      <link>https://dev.to/lorrydriveloper/flatiron-network-1kpo</link>
      <guid>https://dev.to/lorrydriveloper/flatiron-network-1kpo</guid>
      <description>&lt;h2&gt;
  
  
  &lt;center&gt; My Bootcamp Final Project &lt;/center&gt;
&lt;/h2&gt;


&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hR9wUgN_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/rwheycf.jpg" alt="drawing" width="800"&gt;&lt;/center&gt;
&lt;h2&gt;
  
  
  &lt;a href="https://github.com/reddevilcero/flatiron-network-react"&gt;Github Repo&lt;/a&gt;
&lt;/h2&gt;
&lt;h2&gt;
  
  
  &lt;a href="https://flatiron-network.vercel.app/"&gt;LIVE DEMO&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Today's post is about the last project for Flatiron Bootcamp can you believe how far I have arrived in that short amount of time?&lt;br&gt;
You might remember my last &lt;a href="https://dev.to/lorrydriveloper/rails-api-and-js-flatiron-project-3g3b"&gt;post&lt;/a&gt;, where I talked about the idea I had in mind and the partial solution.&lt;br&gt;
Today I'm presenting to the community a starting point to an app for the community by the community. This is an MVP because, as you can understand, the time to finish this project is shorter that the app will need to become something awesome and beneficial.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem I Trying to solve.
&lt;/h2&gt;

&lt;p&gt;You might remember that I talked about the problem in my previous &lt;a href="https://dev.to/lorrydriveloper/rails-api-and-js-flatiron-project-3g3b"&gt;post&lt;/a&gt;. I have noticed that the problem may is deep that only connect people on social media, what about networking where is important, in tech meetups and meetings near you. I think that it can be overwhelming for some people to go to these events by themself, but what about if you can find someone near you that you share the fact that both are in Flatiron? You will be more likely to go with somebody that is in the same situation as you and no feeling to be all on one's own.&lt;/p&gt;

&lt;h2&gt;
  
  
  The App
&lt;/h2&gt;

&lt;p&gt;For this app, I have use material UI it's not a kind of preference or anything like that. I just wanted to learn something new at the same time as creating a well-know design. A good starting point to the Design community a plain start point to deploy its creativity.&lt;br&gt;
Yes, I said the Design community because I would love to see all the branches of the Flatiron community involved in this project, Engineers, designers, data scientists, and cybersecurity. There is a space for everyone in this project, and I would like to see implemented that new awesome features, infographics and data visualizations with the users' data or have an eye-catching design, protect the user's data ...etc&lt;/p&gt;

&lt;h3&gt;
  
  
  CSS on React, YES or NO?
&lt;/h3&gt;

&lt;p&gt;I haven't a strong opinion on this, but I thought for the project can be comfortable that everything is isolated, so if you want to do something with a component style, you don't have to fight with side effects on other ones. Still, I'm open to discussing this if needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I have implemented so far.
&lt;/h3&gt;

&lt;p&gt;As I said, I have myself a lot of good ideas to implement, the ones I have implemented are:&lt;/p&gt;

&lt;h4&gt;
  
  
  The Home page
&lt;/h4&gt;

&lt;p&gt;Here I have implemented basic features using the dev.to API to display the most popular articles on the last week and with the coordinates of the user a basic weather widget.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Map page
&lt;/h4&gt;


&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ixgHRtum--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/T88f8HS.png" alt="drawing" width="600"&gt;&lt;/center&gt;

&lt;p&gt;Thanks to the good habits I have acquired of making code reusable I was able to bring the map class from my previous project to speed up the project with minor change but some of them interesting like:&lt;/p&gt;


&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8llsfpf_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/LeQBQyT.png" alt="drawing" width="600"&gt;&lt;/center&gt;

&lt;p&gt;or the new way to filter by cohort, campus, or course that was a good challenge me:&lt;/p&gt;


&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q2iElTLF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/TKTUwuG.png" alt="drawing" width="600"&gt;&lt;/center&gt;
&lt;h4&gt;
  
  
  Tip: Do you know that setState() can take a callback when it finishes setting the state.
&lt;/h4&gt;


&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E1Pz24pj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/HrzF44i.png" alt="drawing" width="400"&gt;&lt;/center&gt;
&lt;h4&gt;
  
  
  The Networking page
&lt;/h4&gt;


&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IVMEfm-w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/XQ83dSB.png" alt="drawing" width="600"&gt;&lt;/center&gt;

&lt;p&gt;This is just a concept in progress for two main reasons:&lt;br&gt;
CORS and because the Meetup API is a paid one, so I haven't had the chance to spend a lot of time trying to solve this because time is something I haven't had to finish everything.&lt;br&gt;
I have tried to find alternatives, but there aren't solid ones out there.&lt;/p&gt;

&lt;p&gt;The results I'm displaying are the ones that the API Console returns when you play with it.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Profile page
&lt;/h4&gt;


&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X637fK7Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/a25uV8D.png" alt="drawing" width="600"&gt;&lt;/center&gt;

&lt;p&gt;Here is where the user can add its social media and update its information. The Company is still something to implement as I would like to display companies on the map with its employee, but it is something that, but I have to give another thought.&lt;/p&gt;

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

&lt;p&gt;This is a good start point to start contributing to the open-source community. You don't have to try to improve React or other complicated things. This app and me, I'm here to make you comfortable and no to blame or point you; we all have been in the same position, so I will be on your side.&lt;/p&gt;

&lt;p&gt;And that's it, my Bootcamp has come to an end, and I hope it is returning something to this magnific community. See you all on the Open Source Community.&lt;/p&gt;

&lt;h2&gt;
  
  
  𝙏𝙝𝙚 𝙀𝙣𝙙 𝙤𝙛 𝙩𝙝𝙚 𝙛𝙞𝙧𝙨𝙩 𝙨𝙩𝙚𝙥 𝙤𝙛 𝙖 𝙡𝙤𝙣𝙜 𝙡𝙚𝙖𝙧𝙣𝙞𝙣𝙜 𝙟𝙤𝙪𝙧𝙣𝙚𝙮.
&lt;/h2&gt;

</description>
    </item>
    <item>
      <title>Rails API and JS Flatiron Project</title>
      <dc:creator>lorrydriveloper</dc:creator>
      <pubDate>Thu, 28 May 2020 14:23:01 +0000</pubDate>
      <link>https://dev.to/lorrydriveloper/rails-api-and-js-flatiron-project-3g3b</link>
      <guid>https://dev.to/lorrydriveloper/rails-api-and-js-flatiron-project-3g3b</guid>
      <description>&lt;h1&gt;
  
  
  &lt;center&gt;Flatiron Network&lt;/center&gt;
&lt;/h1&gt;

&lt;center&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%2FVBolm77.png" alt="drawing"&gt;&lt;/center&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://github.com/reddevilcero/sushi-store" rel="noopener noreferrer"&gt;Github Repo&lt;/a&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://youtu.be/w1s3MoTHuHY" rel="noopener noreferrer"&gt;Video Demostration&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Today's blog is about the last project I have created for the Flatiron Curriculum. It's the first time I have worked with JS more in deep more than a few DOM manipulations in previous projects, and I have to say I fell in love with it. I don't know why people blame the language when it is compelling and powerful. I love the functions as first-class they are powerful, the Prototypal inheritance, and the closures and its implication. Most of us feel like JavaScript is "Weird" and all those things. Still, when we start to learn Ruby and later Ruby on Rails when we have a doubt or something, it was entirely reasonable that you went to the documentation and looked at what do you want to accomplish. I guess that you don't even know that there is an official documentation/specification for JavaScript apart of if you even use, the MDN that it is an excellent resource. &lt;br&gt;
With all that say, I'm going to introduce my project.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;I always thought that it is not easy to find Flatiron Grads&lt;br&gt;
to share its knowledge and advice. There are a lot of social media with different habits for each individual, some like more Facebook over Twitter (or vice versa), or they prefer Instagram or Slack, or they are Strong on LinkedIn or YouTube. Still, none are on the same page, and you don't know who was doing the same path as you some the advice of a Data Science sure doesn't apply for aUX/UI designer and so on.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Partial Solution
&lt;/h2&gt;

&lt;p&gt;OK, OK, I know this is just a partial solution, but it has a good reason for that. I only implemented some of the solutions that a more sophisticated app will need, and this is just proof of concepts for a  maybe multidisciplinary and complex App, where more Ux/UI could be involved(I want to seek collaboration some of the UX/UI Design London's students to work together)&lt;/p&gt;
&lt;h2&gt;
  
  
  The implementation so far.
&lt;/h2&gt;

&lt;p&gt;As I said, this is more a Playground project where I worked&lt;br&gt;
to get used to new technologies. Like Geolocation and Geode coding, JavaScript and Google Maps and Google Dev Console, and my loved Ruby on Rails as API, if before I was in love now, I'm married with a mortgage, three children and a dog, hahaha.&lt;/p&gt;

&lt;p&gt;First, as always, Rails make things super easy and quick,&lt;br&gt;
set up a new API backend only cost you a few seconds and a line on the terminal to make it alive.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails new {Your project name} --api --database=postgresql&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The second flag &lt;code&gt;--database=postgresql&lt;/code&gt; is to use as DB&lt;br&gt;
PostgreSQL as by default Rails use SQLite3 what is perfect for Development, but it can be a pain when it is time to Deploy, for that reason I always recommend go with PostgreSQL because it will be easier to deploy when is time to so.&lt;/p&gt;

&lt;p&gt;In the beginning, I got overwhelmed by the problem and its&lt;br&gt;
magnitude. I always feel like that when I start a project and even more when&lt;br&gt;
new technology where I'm not confident is involved, so my friend Impostor&lt;br&gt;
Sindrome still appears, but I had been taught well, so I  always break down the problem in small pieces, and easy to accomplish.&lt;/p&gt;

&lt;p&gt;I would like to explain how I solve the Geolocation problem,&lt;br&gt;
and it's integration with Google Maps. First, the gem I used is called Ruby&lt;br&gt;
Geocoder and can be used with ActiveRecord what it makes super convenient for our problem. Early in your model migration, you should have a column for&lt;br&gt;
Latitude and Longitude and, of course, the pieces for an address. For this&lt;br&gt;
project, I just use the user given address for the Geolocation. Still, it can&lt;br&gt;
use IP, or event the 'Plus Code' that Google Maps provides you for any location.&lt;/p&gt;

&lt;p&gt;You don't need to configure lots of things to make it work, but you can use different lookups providers; to keep it simple, I don't go to dive on it. what you need next is to geolocate by the given address, and that is done easily with ActiveRecord:&lt;br&gt;
in your &lt;code&gt;#app/models/YourModel.rb&lt;/code&gt; you should have this code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;geocoded_by :address
before_validation :geocode
validates :latitude, :presence :true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The documentation says &lt;code&gt;after_validation :geocode&lt;/code&gt;, but I&lt;br&gt;
noticed that it can end on lots of no geolocated addresses in your DB. What is&lt;br&gt;
not really what we want, so I think it is better to be sure that only&lt;br&gt;
well-formatted data is saved on DB, if not alert to your user to use a more&lt;br&gt;
general address that can be geolocated.&lt;br&gt;
But wait, &lt;code&gt;geocode_by :address&lt;/code&gt; what that comes. Well, it is a method you should create for your class instance to join all the pieces of and address to a searchable string like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  def address
    [street, city,postcode, state, country].compact.join(', ')
  end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are now sure that we are saving our well-formatted data&lt;br&gt;
on the DB, so it's time to move to the Frontend and the Google Maps.&lt;/p&gt;
&lt;h3&gt;
  
  
  The Map
&lt;/h3&gt;

&lt;p&gt;To be honest, I was scared to work with google maps, and it's API as I have the mental model that it will be difficult and you have to be a professional developer to do so, far from reality.&lt;br&gt;
First, I create a module on my &lt;code&gt;frontend/modules/&lt;/code&gt; called map.js where after I create a class method to display the map on the DOM.&lt;/p&gt;

&lt;p&gt;Before anything, you should have config your Goggle Dev console and enable Maps JavaScript API and have a valid API and add this script to your HTML&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"&lt;br&gt;
   async defer&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;First, I create a module on my &lt;code&gt;frontend/modules/&lt;/code&gt; called map.js, where I created a class Map and its methods to display the map on the DOM.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  class Map {
  static map;
  static markers;
  static init(gradsArray) {
    this.map = new google.maps.Map(document.getElementById("map"), {
      center: { lat: 35, lng: -50 },
      zoom: 3,
    });

    this.markers = gradsArray.map(this.createMarker);

  }

  static closeMarkers(map, markers) {
    markers.forEach(function (marker) {
      map.zoom = 7;
      marker.infowindow.close(map, marker);
    });
  }
  static createMarker(grad) {
    let icon = {
      url:
        "https://coursereport-s3-production.global.ssl.fastly.net/rich/rich_files/rich_files/999/s200/flatironschool.png", // url
      scaledSize: new google.maps.Size(18, 18), // scaled size
      origin: new google.maps.Point(0, 0), // origin
      anchor: new google.maps.Point(0, 0), // anchor
    };
    const infowindow = new google.maps.InfoWindow({
      content: HTMLBuilder.gradCard(grad),
    });
    let marker = new google.maps.Marker({
      position: {
        lat: grad.latitude,
        lng: grad.longitude,
      },
      map: Map.map,
      title: grad.name,
      infowindow: infowindow,
      icon: icon,
    });
    marker.addListener("click", function () {
      Map.closeMarkers(this.map, Map.markers);
      infowindow.open(this.map, marker);
    });
    return marker;
  }
}

export default Map; 

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

&lt;/div&gt;



&lt;p&gt;It's less code that what I expect to make it works and I going to break down and explained.&lt;br&gt;
First, the class only have three methods and two class variables.&lt;/p&gt;

&lt;p&gt;The method init is the responsibility to create the new instance map with nothing on it as you can see here&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;this.map = new google.maps.Map(document.getElementById("map"), {
      center: { lat: 35, lng: -50 },
      zoom: 3,
    }); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first parameter the Map constructor takes is where to render the new map instance, and the second is an object of options. Where I just centre the map on with the coordinated of the middle of the Atlantic ocean to be able to see America and Europe and the zoom that is valued from 1 (all world) to 15 (street) and then creates the markers for the given array of objects passed as an argument whit the class method createMarker&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; static createMarker(grad) {
    let icon = {
      url:
        "https://coursereport-s3-production.global.ssl.fastly.net/rich/rich_files/rich_files/999/s200/flatironschool.png", // url
      scaledSize: new google.maps.Size(18, 18), // scaled size
      origin: new google.maps.Point(0, 0), // origin
      anchor: new google.maps.Point(0, 0), // anchor
    };
    const infowindow = new google.maps.InfoWindow({
      content: HTMLBuilder.gradCard(grad),
    });
    let marker = new google.maps.Marker({
      position: {
        lat: grad.latitude,
        lng: grad.longitude,
      },
      map: Map.map,
      title: grad.name,
      infowindow: infowindow,
      icon: icon,
    });
    marker.addListener("click", function () {
      Map.closeMarkers(this.map, Map.markers);
      infowindow.open(this.map, marker);
    });
    return marker;
  } 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method looks complicated but is straight if you think about it:&lt;br&gt;
First, the method takes as a parameter and object which should have latitude and longitude if we don't want to use a custom icon either have a window that opens when clicking you only have to create a new marker instance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
  let marker = new google.maps.Marker({
      position: {
        lat: grad.latitude,
        lng: grad.longitude,
      },
      map: Map.map});

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

&lt;/div&gt;



&lt;p&gt;and return it, but because we want to customize a bit, we can add these options to the object marker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
   title: grad.name,
   infowindow: infowindow,
   icon: icon 


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

&lt;/div&gt;



&lt;p&gt;the title can be a string that in my case is the name of the grad name the icon is created here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  let icon = {
  url:"YOURURLIMAGE",
  scaledSize: new google.maps.Size(18, 18),
  origin: new google.maps.Point(0, 0), 
  anchor: new google.maps.Point(0, 0)}; 

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

&lt;/div&gt;



&lt;p&gt;You can use the same code and only change the Url and the size to make your icon bigger or smaller, and the InfoWindow is created here previously like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const infowindow = new google.maps.InfoWindow({
      content: HTMLBuilder.gradCard(grad),
    });

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

&lt;/div&gt;



&lt;center&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%2FPlFktH7.png" alt="drawing"&gt;&lt;/center&gt;
    

&lt;p&gt;Where content can be a plain string or a template string with HTML inside, what is what I did to display the grads cards on it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   marker.addListener("click", function () {
     Map.closeMarkers(this.map, Map.markers);
     infowindow.open(this.map, marker);
    });

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

&lt;/div&gt;



&lt;p&gt;Finally, we add an Event listener with this build method, that on click opens the infowindow. Ant that's it you have working a beautiful map with custom markers and highly reusable as you only have to pass an array of object to render a new map with new markers on it.&lt;/p&gt;

&lt;center&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%2FuSdbAH8.png" alt="drawing"&gt;&lt;/center&gt;

&lt;h2&gt;
  
  
  &lt;center&gt;Thanks for reading and Happy Coding.&lt;/center&gt;
&lt;/h2&gt;

</description>
      <category>javascript</category>
      <category>codenewbie</category>
      <category>api</category>
      <category>rails</category>
    </item>
    <item>
      <title>SINATRA at The MVC stadium</title>
      <dc:creator>lorrydriveloper</dc:creator>
      <pubDate>Tue, 10 Mar 2020 17:37:46 +0000</pubDate>
      <link>https://dev.to/lorrydriveloper/sinatra-at-the-mvc-stadium-48aa</link>
      <guid>https://dev.to/lorrydriveloper/sinatra-at-the-mvc-stadium-48aa</guid>
      <description>&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z56XI3F---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/sFgpJwQ.png" alt="drawing" width="600"&gt;&lt;/center&gt;

&lt;p&gt;This is my first full-stack project I ever I did, well I notice that from now on I will have a lot of first times as when more a learn more I see what little I know, and I love it because I always liked the challenges and be out of my comfort zone.&lt;/p&gt;

&lt;p&gt;This project has been really challenging to me in the V of the MVC, and I will explain later why and what V means.&lt;/p&gt;

&lt;p&gt;You can watch a demostratrion &lt;a href="https://youtu.be/g5ACFU5serY"&gt;YouTube video&lt;/a&gt; &lt;br&gt;
and the code at &lt;a href="https://github.com/reddevilcero/trailer_finder"&gt;GitHub&lt;/a&gt; &lt;/p&gt;


&lt;center&gt; &lt;h1&gt;  Let' start with the  &lt;strong&gt;M&lt;/strong&gt; &lt;/h1&gt;
&lt;/center&gt;
&lt;h3&gt;
  
  
  M from Model and the first pillar of useful web and the internet itself on, in other words, &lt;strong&gt;THE DATA&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This part is the one I enjoyed the most, where I feel more comfortable and what I like the most. For that reason and how you can see I create a complex relationships between 6 different models and it is open to extension and ask data between models but that wasn't the project requirements, so I kept it as simple as my brain let me.&lt;/p&gt;


&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mnt8hn0S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/uQSL6wp.png" alt="drawing" width="600"&gt;&lt;/center&gt;

&lt;p&gt;I used custom validations, ActiveRecord ones, has many, belong to,  many to many, and so on.&lt;/p&gt;

&lt;h3&gt;
  
  
  C from Controller or the part of the web that connects the M with the V with some validations and other stuff.
&lt;/h3&gt;

&lt;p&gt;This part has been fun too I always thought have hacker soul of at least I like to believe that hahaha.&lt;/p&gt;

&lt;p&gt;So y tried to protect my View and data from people that are not allowed to do things in my app and not only from the front-end part, if not as well sending PATCH, POST, DELETE from external sources like POSTMAN.&lt;/p&gt;

&lt;p&gt;I broke and fixed my app at least a hundred times, and I'm not 100% sure that is right but as I say before, when more I learn more I see what little I know.&lt;/p&gt;


&lt;center&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--45qJrevR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/5UMeC7r.png" alt="drawing" width="600"&gt;&lt;/center&gt;

&lt;blockquote&gt;
&lt;p&gt;One Controler to rule them all,&lt;br&gt;
   one Controller to find them,&lt;br&gt;
One Controller to bring them all&lt;br&gt;
   and in the View bind them.&lt;/p&gt;


&lt;/blockquote&gt;

&lt;p&gt;Well, I needed four, but in the end, all goes to the ApplicationController so ... &lt;/p&gt;

&lt;p&gt;And I add I little bit of salt with flash messages and two easter eggs I hope you can find (they are not difficult).&lt;/p&gt;

&lt;h3&gt;
  
  
  V for View or how a letter can give you a lot of headaches
&lt;/h3&gt;

&lt;p&gt;The views itself are not a problem, and I like to think about how to render what depends on the actual user but...&lt;/p&gt;


&lt;center&gt;&lt;img src="https://i.giphy.com/media/xZqycRHIQkKNa/giphy.gif" alt="drawing" width="600"&gt;&lt;/center&gt;

&lt;p&gt;I have never been a person who has been good at drawing or creativity, I am not able to distinguish two types of blue if they are close in the RGB range, so I always knew it is going to be the most challenging part and where all my effort has to be the max to make the best I can.&lt;/p&gt;

&lt;p&gt;Whit that says I make &lt;strong&gt;A LOT&lt;/strong&gt; of mistake, every time a change something somewhere breaks, I write &lt;strong&gt;A LOT&lt;/strong&gt; of bad CSS and repeating my self. I am not happy with my code at all, but &lt;strong&gt;I HAVE LEARN SO MUCH&lt;/strong&gt;, so I'm pretty sure I am going to be able to implement that new knowledge and experience in the future projects and my life in general.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Learn How to Learn to Code (part 2)</title>
      <dc:creator>lorrydriveloper</dc:creator>
      <pubDate>Tue, 21 Jan 2020 13:39:02 +0000</pubDate>
      <link>https://dev.to/lorrydriveloper/learn-how-to-learn-to-code-part-2-48o9</link>
      <guid>https://dev.to/lorrydriveloper/learn-how-to-learn-to-code-part-2-48o9</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uFixx-tA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2017/02/01/10/15/brain-2029391_1280.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uFixx-tA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2017/02/01/10/15/brain-2029391_1280.png" alt="drawing" width="400"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;center&gt;&lt;strong&gt;More about Diffuse and Focus Mode&lt;/strong&gt;&lt;/center&gt;

&lt;p&gt;To have new ideas and resolve problems is crucial not only concentrate at the beginning, if not as well leave to have attention to what we are learning. I know it is strange and could sound not appropriate, but you will understand when to do it and why it is essential.&lt;/p&gt;

&lt;p&gt;For the most, the change between diffuse mode and focus mode occurs naturally, when getting distracted and leaves past a small-time.&lt;br&gt;
Walk, going to the gym o any activity that liberates the conscient brain part. This can take even hours(&lt;em&gt;if don't use specific tips&lt;/em&gt;) o what I like to call BDW, Bed, Drive, Walk (&lt;em&gt;this differs for each person&lt;/em&gt;) but basically any relaxing activity than help you start your autonomous mode(&lt;em&gt;more about this soon&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;Maybe after that relaxing session, you may see how quick and easy the solution appears, of course, not without a previous work in focus mode.&lt;br&gt;
That "EUREKA" moment is one of the small pleasures of life(&lt;em&gt;at least for me&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;But don't expect that walking, going to the gym, or sleeping to teach you something. It is the alternation between both modes that will finally give you the expected result.&lt;/p&gt;

&lt;p&gt;To maximize your learning, do small study sessions instead of long and tedious ones, even when you are resting o doing other things your diffuse mode is still working in what you were concentrating/studying. Don't worry if you think you are never in that mode. Everyone does; It is the default mode of the brain.&lt;/p&gt;

&lt;p&gt;Making a simile between study and the gym, lifting weight all day is not going to help you to grow your muscles, as those muscles need time and rest between sessions to develop bigger and stronger in a long way. The persistence in time is the key to everything!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1Px5gHQH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2018/10/02/00/59/computer-3717686_1280.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1Px5gHQH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2018/10/02/00/59/computer-3717686_1280.png" alt="brain with chains" width="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  General triggers of the diffuse mode:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go to the gym.&lt;/li&gt;
&lt;li&gt;Play football, basket or any similar sport.&lt;/li&gt;
&lt;li&gt;Run, walk, swim.&lt;/li&gt;
&lt;li&gt;Dance.&lt;/li&gt;
&lt;li&gt;Go by car or public transport (&lt;em&gt;driving or as a passenger&lt;/em&gt;).&lt;/li&gt;
&lt;li&gt;Draw or paint.&lt;/li&gt;
&lt;li&gt;Have a shower or bath.&lt;/li&gt;
&lt;li&gt;Listen to music, especially instrumental&lt;/li&gt;
&lt;li&gt;Play songs that you know well.&lt;/li&gt;
&lt;li&gt;Meditate or pray.&lt;/li&gt;
&lt;li&gt;Sleep (the diffuse mode definitive!)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Other general triggers of the diffuse mode to use with caution or as a reward(max 10 min). Because it can take you to a new focus mode.
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Play videogames.&lt;/li&gt;
&lt;li&gt;Surf the web.&lt;/li&gt;
&lt;li&gt;Talk/messaging friends.&lt;/li&gt;
&lt;li&gt;Read a book.&lt;/li&gt;
&lt;li&gt;Watch Tv.&lt;/li&gt;
&lt;li&gt;Help others in a simple problem (&lt;em&gt;in my case help my daughter with homework.. the easy ones Jajaja&lt;/em&gt;).&lt;/li&gt;
&lt;/ul&gt;


&lt;center&gt;&lt;strong&gt;Tip&lt;/strong&gt;&lt;/center&gt;

&lt;p&gt;Do not compare yourself with others; take the time that you need to understand the new concepts. If you want to put yourself at the same level of others, you won't dedicate enough time to dominate the matter, and you will finish even more lagging, or simply you will finish leaving because of your frustration and the feeling that you are not good at this.&lt;/p&gt;



&lt;center&gt;&lt;strong&gt;Everyone has its own pace!&lt;/strong&gt;&lt;/center&gt;

</description>
      <category>codenewbie</category>
      <category>learntocode</category>
      <category>beginners</category>
      <category>books</category>
    </item>
    <item>
      <title>Aprende ha aprender como programar.</title>
      <dc:creator>lorrydriveloper</dc:creator>
      <pubDate>Sun, 12 Jan 2020 21:45:01 +0000</pubDate>
      <link>https://dev.to/lorrydriveloper/aprende-a-aprender-como-programar-232l</link>
      <guid>https://dev.to/lorrydriveloper/aprende-a-aprender-como-programar-232l</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RtgWffgg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2015/04/28/07/55/mindset-743166_960_720.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RtgWffgg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2015/04/28/07/55/mindset-743166_960_720.jpg" alt="change your mind" width="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Quiero compartir algunas ideas sobre el libro que leí recientemente, &lt;a href="https://www.casadellibro.com/libro-abre-tu-mente-a-los-numeros/9788491870531/6802129"&gt;Abre tu mente a los numeros&lt;/a&gt; y su &lt;a href="https://www.coursera.org/learn/aprendiendo-a-aprender"&gt;Curso en Coursera&lt;/a&gt;, y consejos útiles para aprender a programar o cualquier cosa que re propongas.&lt;/p&gt;


&lt;center&gt;&lt;em&gt;En primer lugar, esta publicación es un vistazo rápido a asuntos y conceptos complejos.&lt;/em&gt;&lt;/center&gt;


&lt;center&gt;&lt;strong&gt;Consejo&lt;/strong&gt;&lt;/center&gt;
&lt;br&gt;
La lectura previa de cualquier lección o artículo (1 a 2 minutos) en busca de encabezados, preguntas o información antes de leerlo más en profundidad lo ayudará a crear una estructura que luego se llenará con el contenido.


&lt;center&gt;&lt;strong&gt;Introducción a los modos enfocado y difuso&lt;/strong&gt;&lt;/center&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--liXEyojI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.7pace.com/wp-content/uploads/2019/05/focus-vs-diffuse-graphic.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--liXEyojI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.7pace.com/wp-content/uploads/2019/05/focus-vs-diffuse-graphic.png" alt="difusse vs concentrared" width="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Permítanme hacer una analogía entre el cerebro y una computadora con un navegador web.&lt;br&gt;
Digamos que el modo Enfocado es el historial del navegador web de su cerebro, si realiza la consulta correcta, le devolverá un montón de enlaces a sitios web de "Asi se hace" ... Siempre que ya conozcas esos sitios web.&lt;/p&gt;

&lt;p&gt;En cambio, el modo difuso es más como navegar por la Web haciendo clic a en aqui y alla enlaces y banners a otros sitios web y quedandose el tiempo suficiente para hacer clic e ir a otro sitio web ... tal vez su cerebro ya haya visitado el sitio con esa respuesta mágica ... Pero todavía no sale los primeros resultados cuando haces tu búsqueda en el historial.&lt;/p&gt;


&lt;center&gt;&lt;strong&gt;Efecto Einstellung&lt;/strong&gt;&lt;/center&gt;
&lt;br&gt;
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZHNvZXn8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2018/06/01/11/48/brain-3446307_960_720.jpg" alt="brain in chain" width="400"&gt;

&lt;p&gt;El efecto Einstellung es el efecto negativo de la experiencia previa al resolver nuevos problemas.&lt;br&gt;
Manteniedo la analogía cuando buscas en tu historial los primeros resultados siempre son los que ya conoce y en los que tienes mas comodo, no los mejores que quizás conozca, por eso  siempre usa los primeros resultados de tu historial(simple repeticion). El primer enfoque para los nuevos problemas puede ser engañoso debido a este efecto. Tienes que deshacerte de las viejas ideas cuando aprendes nuevas.&lt;/p&gt;


&lt;center&gt;&lt;strong&gt;Ser creativo&lt;/strong&gt;&lt;/center&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0I9iGXOj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2017/02/13/08/54/brain-2062048_960_720.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0I9iGXOj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2017/02/13/08/54/brain-2062048_960_720.jpg" alt="Creative" width="400"&gt;&lt;/a&gt;&lt;br&gt;
El modo difuso es el modo innovador de tu cerebro, el que crea/inventa nuevas estructuras neuronales que luego podras seguir el modo enfocado para repetir o recrear esos pensamientos, pero no para crearlos.&lt;br&gt;
Por esa razón, cuando más piense en ser creativo, menos originales serán sus ideas ya que intentaras seguir patrones que ya conoce y no crearlos.&lt;/p&gt;

&lt;p&gt;Alternar entre ambos modos es vital para su aprendizaje, uno sin el otro no sirve de nada.&lt;/p&gt;

&lt;p&gt;Más en la próxima publicación sobre estos conceptos y cómo alternar modos y cómo ayudan en su aprendizaje.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>spanish</category>
      <category>codenewbie</category>
      <category>learning</category>
    </item>
    <item>
      <title>Learn how to learn code.</title>
      <dc:creator>lorrydriveloper</dc:creator>
      <pubDate>Sun, 12 Jan 2020 21:44:12 +0000</pubDate>
      <link>https://dev.to/lorrydriveloper/learn-how-to-learn-code-2o8m</link>
      <guid>https://dev.to/lorrydriveloper/learn-how-to-learn-code-2o8m</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RtgWffgg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2015/04/28/07/55/mindset-743166_960_720.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RtgWffgg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2015/04/28/07/55/mindset-743166_960_720.jpg" alt="drawing" width="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I want to share some thoughts about the book I have read recently &lt;a href="https://www.google.com/search?q=ISBN+039916524X"&gt;Mind for numbers&lt;/a&gt; and its &lt;a href="https://www.coursera.org/learn/learning-how-to-learn"&gt;Coursera Course&lt;/a&gt;, and helpful tips for learning code or anything you want. &lt;/p&gt;


&lt;center&gt;&lt;em&gt;First of all, this post is a quick look at complex matters and concepts.&lt;/em&gt;&lt;/center&gt;


&lt;center&gt;&lt;strong&gt;TIP&lt;/strong&gt;&lt;/center&gt;

&lt;p&gt;Pre-read any lecture or article (1 to 2 minutes) looking for headings, questions, or before you read it more in deep will help you to create a structure than you later will be filled with the contents. &lt;/p&gt;


&lt;center&gt;&lt;strong&gt;Introduction to the Focused and Diffuse Modes&lt;/strong&gt;&lt;/center&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--liXEyojI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.7pace.com/wp-content/uploads/2019/05/focus-vs-diffuse-graphic.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--liXEyojI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.7pace.com/wp-content/uploads/2019/05/focus-vs-diffuse-graphic.png" alt="focus vs diffuse" width="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me make an analogy between the brain and a computer running an Internet browser. &lt;br&gt;
So the Focused mode is the web browser history of your brain, if you make the right query, it will return a bunch of links to websites of "how-to"…. Whenever you already know those websites. &lt;br&gt;
The diffuse mode instead is more like surfing the Web fast clicking links and banners to other websites and stay enough time to click and move to another…..maybe your brain already has visited the site with that magical answer…. But still isn't the first result when you do your search in the history.&lt;/p&gt;


&lt;center&gt;&lt;strong&gt;Einstellung effect&lt;/strong&gt;&lt;/center&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZHNvZXn8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2018/06/01/11/48/brain-3446307_960_720.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZHNvZXn8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2018/06/01/11/48/brain-3446307_960_720.jpg" alt="brain with chains" width="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Einstellung effect is the negative effect of previous experience when solving new problems.&lt;br&gt;
Keeping with the analogy when you search the first's results are always the ones you already know and are confident at, not the bests you maybe know, but you always use the first's results from your history. The first approach to new problems can be misleading due to this effect. You have to get rid of old ideas when you learn new ones. &lt;/p&gt;


&lt;center&gt;&lt;strong&gt;Be creative&lt;/strong&gt;&lt;/center&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0I9iGXOj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2017/02/13/08/54/brain-2062048_960_720.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0I9iGXOj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.pixabay.com/photo/2017/02/13/08/54/brain-2062048_960_720.jpg" alt="creative brain" width="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The diffuse mode is the innovative mode of your brain, the one who create/invent new neural structures that later your focused mode can follow to repeat or recreated those thoughts but not to create them.&lt;br&gt;
For that reason, when more you think about being creative, the fewer originals your ideas will be as you are trying to follow patterns you already know and not create them.&lt;br&gt;
Alternate between both modes is vital to your learning, one without the other is useless.&lt;/p&gt;

&lt;p&gt;More in the next post about these concepts an how to alternate modes and how they help in your learning.&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>learntocode</category>
      <category>beginners</category>
      <category>books</category>
    </item>
  </channel>
</rss>
