Latest posts — /dev/dragonhttps://ast.rocksUsing redux-form validation with redux-saga, 23 Apr 2018 11:08:01 PDT<p><img class="img-responsive" src="" alt="" /></p> <p>If you work with redux apps a lot, you definitely heard about the `redux-form` package, because working with forms without it is a pain. If not, you should know it simplifies form creation a lot. Even the complex multi-step forms with nested fields could be implemented almost effortlessly using it. The API of the package was recently revamped and it's super fun to use now, but it's also pretty big and you definitely can use some hints on it! :)&nbsp;</p>The road to wisdom, 01 Apr 2018 06:00:36 PDT<blockquote class="pull-right">Well, it's plain and simple to express:&nbsp;<em>Err</em>&nbsp;and&nbsp;<em>err</em>&nbsp;and&nbsp;<em>err again</em>, but less and less and less.<footer><cite>Piet Hein</cite></footer></blockquote>How to avoid concurrency issues in React, 08 Feb 2018 11:47:06 PST<p><img class="img-responsive" src="" alt="" /></p> <p>React proposes a simple declarative way to build an application's view. It's straightforward to write a hierarchy of stateless components or to change a state synchronously. The whole app&nbsp;works as an integration of two pure functions "state(event)" and "view(state)". The behavior is testable and predictable. But you can't make something complex without depending on an external data sources integration: side effects come into the stage. Beware, you're approaching the Dark Zone of functional programming now :)&nbsp;</p>Server-side Google Analytics, 07 Feb 2018 09:46:13 PST<p><img src="" alt="" /></p> <p>Usually, people integrate Google Analytics into their shops via simple pre-generated client-side javascript snippet. It's pretty straightforward, easy to use and works most of the time correctly from the box. So why&nbsp;would anyone want to use a server-side integration?&nbsp;There could be a helluva lot of reasons for that. For example, you may want to track some events from your server-side workers &mdash; it would be ugly and unreliable to involve a browser here. Or you may want to implement a complicated funnel for your sales, mixing client-side events with your CRM events.&nbsp;So, is it possible? Sure, it is, and we'll use Measurements Protocol for this. At the time, it's a most modern way to save raw analytics data to Google Analytics from whatever environment you want. I'll use PHP with Guzzle for code examples, but you surely can use any language and any library: there are no differences in principle at all. And let's assume that you already have the perfectly working client-side integration.</p>Windows workspace with WSL and Docker, 21 Jan 2018 23:00:00 PST<h2>Introduction</h2> <p><img src="" alt="" /></p> <p>As a web developer, I frequently use a lot of command line tools to make my life easier. I prefer to be able to assemble a computer from whatever hardware I want, so I don't like Macs and stuff like this. Linux desktops are good enough our days, but I love to play video games from time to time, and it wouldn't be effortless to keep two different operating systems for work and entertainment. My best compromise was to use Windows.</p> <p>But Windows command line sucks. It sucks a lot. And I don't talk about the `cmd` shell &mdash; it's ridiculous to talk seriously about it in 2018. A little bit more modern command line attempt of Microsoft, the `PowerShell`, has a lot of power, but it lacks the elegance and composability of Unix tools. It's a whole new world where you need to learn funny wtf commands like `Remove-Item dir -recurse` to make the simplest things happen. And, of course, nobody outside the geostationary orbit of Microsoft supports this. To be productive with a command line in Windows you need to do some research, and your road won't be dull.</p>Using Letsencrypt with Docker, 19 Jan 2018 22:39:51 PST<p><img class="img-responsive" src="" alt="" /></p> <p>Who needs all those paid certificate providers while we have such a brilliant project as Letsencrypt? It allows a domain owner to obtain a valid certificate for his domain in a matter of seconds without the boring stuff like generating CSR, making DNS verification records or even passing documents to the certificate issuer center. However, paid certificates most often have an expiration time of a year. And free Letsencrypt certificates live only for a couple of months. But it's definitely not a huge problem if there is a way to automate the renewal process. And there it is.</p>2017, 01 Jan 2018 11:57:58 PST<p>The 2017 year was good for me. It's the second year in a line where I fulfilled all my new year resolutions, which is inspiring. That's why I decided to write a bit about it. The year totally earned it :)</p> <h2>The wedding</h2> <p><img class="img-responsive" src="" alt="The wedding" /></p> <p>I'm a married man now. I have such a beautiful wife! (and still can't fully believe that). But I don't see any changes inside me: I think I married her in my mind long before that, but it's great to have a real ceremony and to eat a real cake! :) The day before the wedding I fell from my bike and got a severe knee injury. I'll never forget dancing the waltz all in bandages like a mummy, with terrible pain and only one leg working fine, but it was worth all the efforts.</p>Books, 05 Feb 2017 05:16:40 PST<p>Books were hard to get at a time when I was a kid. They were expensive and, moreover, there was a complete lack of them. Many people owned no books at all, and some other copied them manually (by hand). But there always were a lot of books in our family, and it was shocking to me back then &mdash; to see no books at all in a room.</p> <p>Not all of the books from our family collection were good. Most of them were pretty cheap detectives and other silly novels from barely known authors. The only thing they were good at is&nbsp;the creation of the warm relationships between me and the book species. But among this mess, there were a lot of hidden treasures.</p> <p>Once I spotted that my father left the book he was reading at that time, on the table. I, for some reasons, thought that I'm not allowed to read or even touch adult books as I was a nothing but the little child. No one was near, and I dared to take it and read it, secretly. It was &laquo;Lord Valentine's Castle&raquo; by Robert Silverberg.</p> <p>To my astonishment, it was not too different by its nature from what I've read before. It was way better than all these child books, so I fell in love with it from the first pages. I was reading this book secretly for a long time as I wasn't alone most of the times and not every day I was even aware of the location of this book.</p> <p>I think that at some point my secret love affair with this book was spotted by my father. He said nothing about it, so I'm not sure if that was the trigger. But sometime after that, he offered me another book from his collection of science fiction to read. It was the &laquo;Deathworld&raquo; by Harry Harrison.</p> <p>From that time I created a personal ritual for reading. Every evening, I take a fruit or two, go to bed, take a book and read it for an hour or two. That was the time I first met Heinlein, Simak, Asimov, Zelazny, Sheckley and other cool guys I owe so much for my very own personality, consciousness and the way I see the world now.</p>A Few Notes on Composition of Reducers, 26 Dec 2016 20:16:00 PST<p><img class="img-responsive" src="" alt="" /></p> <p>Managing the state of an application with libraries like `redux` is awesome. It provides a really easy way to write simple and testable code for state transitions. You only need to decide on a structure of the desired state and write a corresponding pure function.</p> <p>There is no doubt that a reducer could look super simple in the cases like the following one:</p> <p>Our main task as developers is to keep all reducers as simple as possible. Simple reducer is easily understandable and it's not a big deal to write a couple of helpful tests for it. But the state grows bigger and becomes more and more complex as we add more cool features to our apps. We need a technique to hide this complexity somewhere.</p> <p>Every reducer is just a common pure function. No magic at all. Therefore it's possible to write such a reducer function which will take a set of other reducers on its input to produce their results in a combination of some sort. Let's look at a few examples:</p>How To Update Cloudfront Certs With Letsencrypt, 25 Dec 2016 03:27:39 PST<p>Letsencrypt is an excellent service for obtaining totally free security encryption certificates. Fortunately, it also has a marvelous client named Certbot. Let's install it.</p>