<?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: Binyamin Galinsky</title>
    <description>The latest articles on DEV Community by Binyamin Galinsky (@binygal).</description>
    <link>https://dev.to/binygal</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%2F50648%2Fa2bd23d1-0fb5-4fd8-ac60-40bd9a064b51.jpeg</url>
      <title>DEV Community: Binyamin Galinsky</title>
      <link>https://dev.to/binygal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/binygal"/>
    <language>en</language>
    <item>
      <title>What will you want to read?</title>
      <dc:creator>Binyamin Galinsky</dc:creator>
      <pubDate>Fri, 20 Jul 2018 05:28:29 +0000</pubDate>
      <link>https://dev.to/binygal/what-will-you-want-to-read-2h6a</link>
      <guid>https://dev.to/binygal/what-will-you-want-to-read-2h6a</guid>
      <description>&lt;p&gt;I wrote some blog posts recently and I'm in the retrospective stage analyzing the data from those posts. &lt;br&gt;
It seems that people prefer career stuff over technical stuff.&lt;br&gt;
What do you like to read?&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>5 Lessons learned from side projects</title>
      <dc:creator>Binyamin Galinsky</dc:creator>
      <pubDate>Fri, 29 Jun 2018 15:12:30 +0000</pubDate>
      <link>https://dev.to/binygal/5-lessons-learned-from-side-projects-4gdb</link>
      <guid>https://dev.to/binygal/5-lessons-learned-from-side-projects-4gdb</guid>
      <description>&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1004342391137034240-631" src="https://platform.twitter.com/embed/Tweet.html?id=1004342391137034240"&gt;
&lt;/iframe&gt;

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



&lt;/p&gt;

&lt;p&gt;From my first days as a professional software engineer, I always spent some time in developing my own side projects. While some side projects doesn’t make sense (like the tweet above), I saw that side projects were a huge benefit for my career, so I decided to write some of the lessons I learned of how to maximize the effect of side projects.&lt;/p&gt;

&lt;h1&gt;
  
  
  Go live!
&lt;/h1&gt;

&lt;p&gt;Yes, you heard me… Go live with your side project! Recently I built my challenge web site, (&lt;a href="http://www.mypopchallenge.xyz" rel="noopener noreferrer"&gt;www.mypopchallenge.xyz&lt;/a&gt;) and while the UI is not very impressive, I found very interesting challenges when it came to deployment. The fact that my 1 year with free tier at AWS is over made me write some scripts to synchornize between my now.sh instance and Netlify deployment so I can use them both and keep my expenses to the minimum.&lt;/p&gt;

&lt;p&gt;Going live is not just about publishing your app to the app store or deploying your website to the web. It can be publishing a library to npm or even just open sourcing the code so people can see it, use it and learn from it.&lt;/p&gt;

&lt;p&gt;So here is my first suggestion — Go Live!&lt;/p&gt;

&lt;h1&gt;
  
  
  Don’t try to make money out of it
&lt;/h1&gt;

&lt;p&gt;When you’re trying to make money out of your app, you start to get crazy. You can imagine yourself in piles of money and you are working towards it. Isn’t that good? I think it is amazing. It is a spirit of entrepreneurship and lots of good products started like that. But this is not a side project. You definitely will learn a lot but when you start to see money out of it, it will be very hard to abandon it, which is sometimes the right thing — to concentrate more on your daily job or to start a new side project with a new technology you want to learn.&lt;/p&gt;

&lt;p&gt;And here is my advice — build side projects for fun, not for money.&lt;/p&gt;

&lt;h1&gt;
  
  
  Learn incrementally
&lt;/h1&gt;

&lt;p&gt;So you have an idea: it’s the best ToDo app the world has never seen… You heard about this amazing front end framework that has 1 billion stars on GitHub and the server must be with that data transfer hot framework, you also know 3 cool JS libraries that you must try, and you want to try your skills as microservices architect. Sounds a lot? It is a lot! side projects has the nature of being fuelled solely by motivation only, and as such you need to see results fast, or the motivation will blow away for the next cool idea. And guess what, in a month you will have another half baked repo with 2 microservices, half of data layer and a piece of front end.&lt;/p&gt;

&lt;p&gt;My advice — choose one new technology at a time for your side projects.&lt;/p&gt;

&lt;h1&gt;
  
  
  Work alone
&lt;/h1&gt;

&lt;p&gt;90% of a problems in a software development team are communication problems, the rest are problems that people can’t communicate well enough to explain. When you add a members to your side project team, you need to spend time on communication. And while communication with other people is awesome, you won’t get the benefit that you want your side project to give. (I’m not coding on in code communication methods. All of my side projects documented and have full Readme files)&lt;br&gt;
If you don’t want to explain why you decided to change the technology stack, or to spend 25% of your time on syncronization inside the team, leave it alone.&lt;/p&gt;

&lt;p&gt;My advice — Side projects are exactly the time to enjoy pure experience of coding alone which is the experience most of us used to love when they choose to learn how to code.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: sometimes when the scope of the project is too big, you already went live and you want to go faster or you just started your side project so you can learn how to communicate better, it’s actually make sense to work together.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Code together
&lt;/h1&gt;

&lt;p&gt;The fact that you’re working alone, doesn’t necessarily means that no one should see your code. When ever someone ask for my advice to improve I’m telling him this advice — “Find some one to review your code”. When I write a critical section code, I will always show it to someone. I ask a lot about the design and I am trying to get as much people involved in a friendly, advising position. If you don’t have anyone to do that for you, there are a lot of people out there that will be glad to help with that. (fun fact — I never got bad comments on my code when friends review it. I guess there is a correlation between the willingness to review someone code as a favor, and having good programming skills)&lt;/p&gt;

&lt;p&gt;My advice — share your code as much as you can to get feedback and become better.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Side projects are fun. I love the feeling of showing some of my work to people and the excitement to see people interacting with my products. I learned a lot from my side projects and the lessons I gave above are highly optimized to learn. If you have other experience or another lesson that you learned from your side project, please write a comment about it. Also if you want to share your side project I would love to see a link in the comments. &lt;/p&gt;

&lt;p&gt;This is my first cross-posting from Medium. I hope you would like it, and I hope I found a new place for positing my thoughts.&lt;/p&gt;

</description>
      <category>sideprojects</category>
      <category>coding</category>
      <category>improve</category>
    </item>
    <item>
      <title>How I managed to deploy my side project for free</title>
      <dc:creator>Binyamin Galinsky</dc:creator>
      <pubDate>Wed, 27 Jun 2018 11:47:28 +0000</pubDate>
      <link>https://dev.to/binygal/how-i-managed-to-deploy-my-side-project-for-free-42a6</link>
      <guid>https://dev.to/binygal/how-i-managed-to-deploy-my-side-project-for-free-42a6</guid>
      <description>&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%2Fuploads%2Farticles%2Fat4ojxgp9f81hg0pe6zj.jpeg" 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%2Fuploads%2Farticles%2Fat4ojxgp9f81hg0pe6zj.jpeg"&gt;&lt;/a&gt;Side projects are awesome&lt;/p&gt;

&lt;p&gt;After my latest post about &lt;a href="https://dev.to/binygal/5-lessons-learned-from-side-projects-4gdb"&gt;lessons learned from doing side projects&lt;/a&gt; I’ve been asked to help some people with their side projects. One question that I’ve been asked a lot is — “How can I just play with code and publish my side project for free”. Many of us are building stupid side projects (&lt;a href="http://www.mypopchallenge.xyz" rel="noopener noreferrer"&gt;Like this one&lt;/a&gt;) and we don’t want to spend money on hosting. I believe that you should publish your work to the world, so I came up with this guide for deploying a client-server web app to for free.&lt;/p&gt;

&lt;h3&gt;
  
  
  It’s all about the name
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://medium.com/media/0c65a3800bace6e2a0ae1a58e28776ec/href" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://medium.com/media/0c65a3800bace6e2a0ae1a58e28776ec/href" rel="noopener noreferrer"&gt;https://medium.com/media/0c65a3800bace6e2a0ae1a58e28776ec/href&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Think about the following situation. You come back from a party and tell your roommate about his friend that you met there. You can say “He was tall, brown eyes, had a short beard…” It can take hours… Wouldn’t it be much faster to say “I met you friend Bob in the party”? The human brain is built for names. We give name to things, then we have alias to people, places and products. That’s why you want to have a domain instead of giving people your ip address (And you must admit, seeing links to ip addresses is suspicious anyway) . You can start with free domain from &lt;a href="http://www.dot.tk/" rel="noopener noreferrer"&gt;http://www.dot.tk/&lt;/a&gt; and later on, when your side project starts to gain some traffic and maybe even bring in some money you can upgrade to a payed domain.&lt;/p&gt;

&lt;h3&gt;
  
  
  Static resources need static hosting
&lt;/h3&gt;

&lt;p&gt;Hosting a static website should be pretty easy. You should be able to throw your files in the cloud, point a domain to that place, and let other people try your webapp. &lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt; is a place to do exactly that! Their free plan is pretty good, letting you use your custom domain, SSL and configure your Git repo for auto deployment. It’s pretty straight forward and easy to use. You should checkout their &lt;a href="https://www.netlify.com/docs/continuous-deployment/" rel="noopener noreferrer"&gt;Continuous deployment&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Server deployment
&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%2Fuploads%2Farticles%2Fbprgmaz03wufyn84oktg.jpeg" 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%2Fuploads%2Farticles%2Fbprgmaz03wufyn84oktg.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While static resources are easy to deploy (and cheap to host), server is a whole different story. When no one uses your app, your statice resources are doing nothing, but your server keep running. That’s why free server solutions are rare and limited. Lucky you — There are couple free server solution that I’m aware of.&lt;br&gt;&lt;br&gt;
&lt;a href="https://www.heroku.com/" rel="noopener noreferrer"&gt;Heroku&lt;/a&gt; gives you a free server. You can have your custom domain, but the server will go to sleep after 30 minutes of inactivity (and it takes time to wake up a sleeping server) and you are limited to certain number of computation hours.&lt;br&gt;&lt;br&gt;
&lt;a href="http://now.sh" rel="noopener noreferrer"&gt;now.sh&lt;/a&gt; gives you unlimited hours but you can’t have your custom domain — the meaning is that with every deployment you will have new url that points to the new version of your server, be aware that now.sh will also open source your code.&lt;/p&gt;

&lt;p&gt;For my side project I decided to go with now.sh, but there are some things that I did to make my experience nicer.&lt;/p&gt;
&lt;h3&gt;
  
  
  How to hide sensitive parts of your code
&lt;/h3&gt;

&lt;p&gt;OK, so I’m not really hiding part of my code. I didn’t try to do so, and I’m not sure you’re allowed to do it by now.sh license even if you find a way. I’m talking about my passwords.&lt;br&gt;&lt;br&gt;
I’m ok with open sourcing my code, but I don’t want my database connection string, my product email address and its password to be open to the world. The solution is environment variables. Passing those passwords while starting the app, instead of putting them hard coded is a good practice that you should always do, but when it comes to open source, it’s even more crucial. Now supports passing environment variables through it cli tool and you need to use that ability to keep your data safe.&lt;/p&gt;
&lt;h3&gt;
  
  
  How to overcome the ever changing server url
&lt;/h3&gt;

&lt;p&gt;As I mentioned before, now.sh does not support custom urls in its free service. Every time you will deploy a new version of your server, your server url will be changed, so you need to change the client accordingly. The first step toward doing that is having one place in the client to set the server url. I tend to have a config.js file that exposes the server url.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;serverUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://myserver.com&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;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nx"&gt;SERVER&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="na"&gt;_URL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;NODE&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;_ENV&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;development&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; 
 &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://localhost:3000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;serverUrl&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="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see in the code above, this is a good practice for changing environments, but it’s also very good to have one place to declare the server url, so it’s easy to change it later.&lt;br&gt;&lt;br&gt;
Now I wrote a script to deploy. My script has three parts. It will deploy the server to now.sh, it will take the url that now will send back, then it will change the config.js file to point to the new server url and finally it will push the changes to my deploy branch so my client will be updated. I’ve open sourced this script as an npm package and you can see it &lt;a href="https://github.com/binygal/nownet-deploy" rel="noopener noreferrer"&gt;here&lt;/a&gt;. (The readme file contains explanations of how exactly to use and configure this script).&lt;/p&gt;

&lt;p&gt;I hope my post will help you to deploy your side project, and I would love to hear how you use my script or what is your side project in the comments or on Twitter. If you have any questions about the script or anything, don’t hesitate to ask me. My Twitter DM box is open. As always, you can follow me to hear about my next adventure in the programming world.&lt;/p&gt;

</description>
      <category>deployment</category>
      <category>zeit</category>
      <category>free</category>
      <category>sideprojects</category>
    </item>
    <item>
      <title>Continuously running Flowtype checks with jest runner</title>
      <dc:creator>Binyamin Galinsky</dc:creator>
      <pubDate>Mon, 26 Mar 2018 20:06:43 +0000</pubDate>
      <link>https://dev.to/binygal/continuously-running-flowtype-checks-with-jest-runner-af9</link>
      <guid>https://dev.to/binygal/continuously-running-flowtype-checks-with-jest-runner-af9</guid>
      <description>

&lt;p&gt;A few weeks ago I became part of a new project. The first thing I did was to set up my regular workspace in preparation for coding. My usual set up is VSCode on one screen, iTerm running Jest on the other and Chrome open in the background. Everything was perfect, I grabbed a cup of coffee, sat down in front of my desk and realised that something was missing… This project was configured with Flowtype and I wanted it to run continuously on my screen showing me if I miss some type definition (I’m a forgetful programmer and I need constant reminders while adding new tech to my stack).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My problem was that Flow don’t have watch mode.&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  What is Jest runner?
&lt;/h4&gt;

&lt;p&gt;Jest is Facebook’s test platform. As Jest got more and more mature many abilities were implemented in it, and the core team understood that running tests is just small part of Jest abilities. One of Jest abilities is watch mode for reruns on file changes.&lt;/p&gt;

&lt;p&gt;Since v.21 of Jest, it is possible to replace the jest test runner with your own runners and this opens a lot of opportunities like running Mocha tests using the Jest platform, running eslint linting and in our case — Flowtype checks.&lt;/p&gt;

&lt;p&gt;(If you want to learn more about Jest as a platform, you should watch the following amazing talk)&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/NtjyeojAOBs"&gt; &lt;/iframe&gt;&lt;/p&gt;

&lt;p&gt;According to &lt;a href="https://facebook.github.io/jest/docs/en/configuration.html#runner-string"&gt;Jest documentation&lt;/a&gt; the runner should return an object with runTests function. When Jest will run our runner it will pass it some callback functions one of those is onResult which we should call with our tests results either fail or pass.&lt;/p&gt;

&lt;p&gt;Here is the implementation for runTests function explained in details:&lt;/p&gt;

&lt;p&gt;We will start by storing the start time and immediately execute the flow check with child_process (note that runTests should return a promise to notify jest that the testing is done so everything is encapsulated inside a promise).&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const start = +new Date();
exec('flow', { stdio: 'ignore', cwd: process.cwd() }, (err, stdout) =&amp;gt; {
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next we will use the output that we receive as the stdout arg in exec callback to generate an object that holds all of the errors. The object is structured with the file paths as the property name and the error for that path as the value as follows:&lt;br&gt;&lt;br&gt;
&lt;code&gt;index.js: error: String should be int&lt;/code&gt;&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const errors = stdout.split('Error');
const errorsPerFile = errors.reduce((previous, current) =&amp;gt; {           
  const firstErrorLine = current.split('\n')[0]; 
  const fileNameMatcher = firstErrorLine.match(/( **\.** {1,2}| **\/** )?([A-z]| **\/** |-)\ ***\.** js(x?)/);          
  if (fileNameMatcher) {            
    const fileName = path.join(process.cwd(), fileNameMatcher[0]);            
    const errorMessage = current.substring(current.indexOf('\n') + 1);            
    if (!previous[fileName]) {
      previous[fileName] = [];            
    }            
    previous[fileName].push(errorMessage);
  }          
  return previous;
}, {});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now that we have the errors per file object we just need to iterate all of our tests and see if they have an entry in that object. If they have entry it means that we have an error in that file, otherwise we can mark this file as pass. We will use the pass and fail functions from &lt;a href="https://github.com/rogeliog/create-jest-runner"&gt;create-jest-runner&lt;/a&gt; to mark our tests by their status. At the end of the method we will resolve the promise we returned.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tests.forEach((t) =&amp;gt; {        
  let testResults;        
  if (errorsPerFile[t.path]) {        
    testResults = fail({      
      start,              
      end: +new Date(),        
      test: { path: t.path, errorMessage: errorsPerFile[t.path] },            
    });        
  } else {        
    testResults = pass(
      { start, end: +new Date(), test: { path: t.path } });          
  }          
  onResult(t, testResults);        
  });        
resolve();
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;That’s it. I would love to hear your thoughts about this post and what else do you think can be done with Jest-Runners. Please leave a comment or DM me on Twitter. The full code can be found in the &lt;a href="https://github.com/binygal/jest-runner-flowtype"&gt;repo&lt;/a&gt;.&lt;/p&gt;


</description>
      <category>javascript</category>
      <category>flowtype</category>
      <category>jest</category>
      <category>jestrunner</category>
    </item>
  </channel>
</rss>
