<?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: Javier Guerra</title>
    <description>The latest articles on DEV Community by Javier Guerra (@javierg).</description>
    <link>https://dev.to/javierg</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%2F29422%2F011d6cb1-c735-4388-8a97-7df1e26c47bb.jpg</url>
      <title>DEV Community: Javier Guerra</title>
      <link>https://dev.to/javierg</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/javierg"/>
    <language>en</language>
    <item>
      <title>Configuring TravisCI for phoenix with dart-sass</title>
      <dc:creator>Javier Guerra</dc:creator>
      <pubDate>Sat, 02 Apr 2022 01:55:14 +0000</pubDate>
      <link>https://dev.to/javierg/configuring-travisci-for-phoenix-with-dart-sass-1l6g</link>
      <guid>https://dev.to/javierg/configuring-travisci-for-phoenix-with-dart-sass-1l6g</guid>
      <description>&lt;p&gt;After a couple of years with our full-stack PhoenixFramework app on production, there have been a constant: node-sass breaks a lot. Every couple of weeks not paying attention to node modules, resulted in security patches to apply, that where blocked by node-sass not being able to compile because some random reason.&lt;/p&gt;

&lt;p&gt;When Phoenix 1.6 was released, with node and WebPack free asset build, We decided to plan the migration out of WebPack and the main motivator, was get rid of as many node dependencies as possible. At the end we keep some node modules, all related to bootstrap.&lt;/p&gt;

&lt;p&gt;The process we follow was based on the documentation provided by:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/phoenixframework/esbuild"&gt;https://github.com/phoenixframework/esbuild&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/CargoSense/dart_sass"&gt;https://github.com/CargoSense/dart_sass&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The decision to use Dart Sass was due to the decision by the sass project to not add more features to it. Also, if we could get rid of the single binary dependency that is the cause for most  of the issues, was a big plus.&lt;/p&gt;

&lt;p&gt;Everything went smoothly, until we try to deploy.&lt;/p&gt;

&lt;p&gt;Our infrastructure deploys to VMs in RackSpace. We use the Travis CI process to compile and deploy the application. We are able to just build a tar file that gets pushed and deployed to the RS servers with Capistrano. Very little dependencies on the server side, no build tools on there, no ruby, elixir or OTP installed, just basic Linux installation.&lt;/p&gt;

&lt;p&gt;So we followed instructions and installed Linux Homebrew (linuxbrew):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;before_install:
  - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  - export PATH=/home/linuxbrew/.linuxbrew/bin:$PATH
  - test -r ~/.bash_profile &amp;amp;&amp;amp; echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" &amp;gt;&amp;gt; ~/.bashrc
  - brew install sass/sass/sass
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which resulted in this error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pub get
Because sass depends on cli_pkg ^2.1.0 which doesn't match any versions, version solving failed.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After some research I found the culprit:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DcoOmMMg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lsxkrmsdnrwrzwqd553k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DcoOmMMg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lsxkrmsdnrwrzwqd553k.png" alt="https://github.com/sass/dart-sass/issues/1660" width="880" height="526"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Tl;DR: A dart-sass dependency (&lt;code&gt;cli_pkg&lt;/code&gt;) publish version 2.1.0, people start including it in their libraries, then retracted, so now dart-sass can't build the package.&lt;/p&gt;

&lt;p&gt;So I start looking for alternatives, and my first try was override the tapped version because, why not?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; - brew tap sass/sass
  - sed -i 's/archive\/1\.49\.10/archive\/1.49.9/' /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/sass/homebrew-sass/sass.rb
  - sed -i 's/3887b89d99fd52e49e5a33ec78b3705a25a6267bd9f85c16fc85a6f4bdf154e5/0df1e9d5ff73a752fe864fac58d8a010c3a089b07d9ba9a05f54d493fd26af8b/' /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/sass/homebrew-sass/sass.rb
Author
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After realizing how terrible this is, and reading again the documentation from dart-sass I saw how clear they recommend using the prebuilt binaries, so I did that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;before_install:
  - rvm install 'ruby-3.0.0'
  - curl -L https://github.com/sass/dart-sass/releases/download/1.49.10/dart-sass-1.49.10-linux-x64.tar.gz &amp;gt; dart-sass-1.49.10-linux-x64.tar.gz
  - tar -xvf dart-sass-1.49.10-linux-x64.tar.gz
  - echo 'export PATH="$PATH:$HOME/build/amco/contentinator/dart-sass:$PATH"' &amp;gt;&amp;gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which works great!&lt;/p&gt;

&lt;p&gt;The issue was a problem for me from yesterday, today I found the workaround and by now the bug has been resolved. I haven't try again to use Linuxbrew, and probably I will not, I might just keep the standalone library and just write some task insdie capistrano to handle versioning.&lt;/p&gt;

&lt;p&gt;The PR was pushed and my package-lock.json file wen't from 13k+ lines, to just 75. 🎉&lt;/p&gt;

</description>
      <category>travisci</category>
      <category>deployment</category>
      <category>elixir</category>
      <category>phoenixframework</category>
    </item>
    <item>
      <title>Plug me in</title>
      <dc:creator>Javier Guerra</dc:creator>
      <pubDate>Sat, 25 Sep 2021 04:29:47 +0000</pubDate>
      <link>https://dev.to/javierg/plug-me-in-57p0</link>
      <guid>https://dev.to/javierg/plug-me-in-57p0</guid>
      <description>&lt;p&gt;Plug is a great tool. It brings a great way to extend, in a clear and encapsulated way, behaviors and state changes to controller flow.&lt;/p&gt;

&lt;p&gt;For example, we can do a plug to set a custom header in a router pipe for Phoenix.&lt;/p&gt;

&lt;p&gt;To do so we Crete a plug module&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="k"&gt;defmodule&lt;/span&gt; &lt;span class="no"&gt;MyApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;CustomHeadersPlug&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="no"&gt;Plug&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;Conn&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;opts&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;conn&lt;/span&gt;
    &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;put_resp_header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Custom-Header"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="no"&gt;End&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we can implement in the router:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;  &lt;span class="n"&gt;pipeline&lt;/span&gt; &lt;span class="ss"&gt;:web&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;plug&lt;/span&gt; &lt;span class="no"&gt;MyApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;CustomHeadersPlug&lt;/span&gt;
    &lt;span class="o"&gt;...&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's it. Any request going through this pipeline will have in it's response &lt;code&gt;x-custom-header: value&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>elixir</category>
      <category>phoenix</category>
      <category>plug</category>
    </item>
    <item>
      <title>I am a sin(x–π) Developer</title>
      <dc:creator>Javier Guerra</dc:creator>
      <pubDate>Mon, 10 Aug 2020 21:25:24 +0000</pubDate>
      <link>https://dev.to/javierg/i-am-a-sin-x-developer-4cn2</link>
      <guid>https://dev.to/javierg/i-am-a-sin-x-developer-4cn2</guid>
      <description>&lt;p&gt;One of the first programs I ever wrote was something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;100 CALL CLEAR 
110 OPTION BASE
120 FOR 1=0 TO 20 
130 PRINT SIN(X-3.141592)
140 NEXT X
150 END
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will return something like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3GU0FHVR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/salfxq432gos826bl80y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3GU0FHVR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/salfxq432gos826bl80y.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Look how beautiful values alternate between positive and negative. How there is a balance between peaks and valleys. This illustrates the realities of being a software developer.  Some times you will be killing it. Solving problems at a great rate. But then, no matter what process you follow, there will be valleys were your output will be flat, at best, and some times even negative, producing technical debt that will make any work done during this period "backward" progress on any work that you are making.&lt;/p&gt;

&lt;p&gt;Having consciousness if you are on the top of the sine or at the bottom is hard. Is this, what makes a good programmer great. A great programmer understands when he is burned and takes his time to rest the mind and allow his performance curve to go up.&lt;/p&gt;

&lt;p&gt;Management has to understand this. Having strategies that allow a team to work out these different performance stages will prevent permanent burn out, and loss of talent. Promoting healthy habits in the team and allowing people to recover from performance peaks.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>When hiring, do you ask for age?</title>
      <dc:creator>Javier Guerra</dc:creator>
      <pubDate>Fri, 01 Jun 2018 05:16:17 +0000</pubDate>
      <link>https://dev.to/javierg/when-hiring-do-you-ask-for-age-4e8a</link>
      <guid>https://dev.to/javierg/when-hiring-do-you-ask-for-age-4e8a</guid>
      <description>&lt;p&gt;We have been very active hiring developers. I, as manager have to select from the candidates CVs and do follow up interviews.&lt;/p&gt;

&lt;p&gt;I never ask age or care about it.&lt;/p&gt;

&lt;p&gt;Recently saw a post on Twitter looking for a developer with 1 year experience, and specified age range.&lt;/p&gt;

&lt;p&gt;Not sure if this common practice in other countries (I work in Mexico). But I find it that it only reduce options (setting aside that is just descriminatory).&lt;/p&gt;

&lt;p&gt;Not sure if there is an actual value on setting an age limit when looking for dev candidates, that I am missing.&lt;/p&gt;

</description>
      <category>management</category>
      <category>recruiting</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Why I learned Elixir Lang</title>
      <dc:creator>Javier Guerra</dc:creator>
      <pubDate>Sat, 25 Nov 2017 15:12:32 +0000</pubDate>
      <link>https://dev.to/javierg/why-i-learned-elixir-lang-99f</link>
      <guid>https://dev.to/javierg/why-i-learned-elixir-lang-99f</guid>
      <description>&lt;p&gt;I am always learning new things. And is not in a bragging sense that I said it. Is more a yell for help. Many times I spend my free time hook in an article about this new thing that I read mentioned on a twit.&lt;/p&gt;

&lt;p&gt;I am getting better on not doing that, and respect my free time. I walk more, spend more time playing with my daughter or just laying face up on my bed looking for figures in the blank ceiling on my bedroom.&lt;/p&gt;

&lt;p&gt;But 6 years ago, when in the company I work for, we decided to use CouchDB, I found amazing how it worked and I started looking for a way to better the speed on index view building. So I read that doing it on Erlang was better. And that started a chain reaction where I start learning Erlang. At the time I was experimenting with Scala, so I look for something similar, at least that was my reasoning, that compiled to BEAM, and that was more expressive to build my views. I found Elixir Lang, so I start playing with it. 5 years later, we have 1 API wrote in Elixir on production, and another Phoenix Framework project on its way. And more important, I think, my understanding of Ruby (my primary work language) has increased dramatically.&lt;/p&gt;

&lt;p&gt;Understanding what is not Object Oriented Programming, has helped a lot un really grasp what it is. It also, allows me to understand Procs and Lambdas, and to reduce side effects on my day job coding.&lt;/p&gt;

&lt;p&gt;Thanks Elixir, now, I will lay on my bedroom and think about it a little more.&lt;/p&gt;

</description>
      <category>elixir</category>
      <category>ruby</category>
      <category>programming</category>
      <category>opinion</category>
    </item>
    <item>
      <title>A mystique guide on boarding CouchDB </title>
      <dc:creator>Javier Guerra</dc:creator>
      <pubDate>Thu, 23 Nov 2017 14:35:50 +0000</pubDate>
      <link>https://dev.to/javierg/a-mystique-guide-on-boarding-couchdb-3gl</link>
      <guid>https://dev.to/javierg/a-mystique-guide-on-boarding-couchdb-3gl</guid>
      <description>&lt;p&gt;Our stack includes CouchDB consumed in Rails applications. Every time a new developer starts working in it, the first complain is how human thought is designed to create associations everywhere, and how the patterns the mind build are better represented by RDBS.&lt;/p&gt;

&lt;p&gt;To them, I just ask them, to let go. Let go all your attachments, let the attachments go into stand alone documents. Stop expecting relationships to be for ever, but embrace them in a nested structure with relevant data. Stop expecting that the world won't change, and drop any idea of implementing schemas in a non RDBS.&lt;/p&gt;

&lt;p&gt;Document Based data bases are not best or worst than RDBS, they are a different paradigm, and approach the world in a different way. Somethings are hard, others easier. But it will be impossible if you keep thinking relational while doing non RDBS.&lt;/p&gt;

</description>
      <category>couchdb</category>
      <category>opinion</category>
      <category>database</category>
    </item>
  </channel>
</rss>
