One-liner for serving static files in Go explained
Whenever I want to set up a server for serving static files in Go, which is not often, I always have to spend some time to figure out the following one-liner. http.Handle(“/images/”, http.StripPrefix(“/images/”, http.FileServer(http.Dir(“./images”)))) What confuses me probably the most here is all three strings being practically the same. So in this post I will…
Input validation with Folktale
In this post I’ll show a way to do input validation in JavaScript using Folktale which is a library for functional programming. The beauty of this approach is having validation rules (is required, is email, is confirmed, etc) specified as a callbacks so they can be reused across different forms and also the absence of…
The best way of rendering a collection of items in React/Redux
In short The best way to render a collection in React, backed by Redux or other similar library: store a collection as an object where key is item id and value is item itself. That way when rendering collection, pass only item’s id to the item component. Than in item’s connected component query a collection…
Like/dislike content or remove vote
I’m building an app around YouTube iframe api (which I wrote about already), where user can like/dislike content (a type of video which is a compilation of songs that can be targeted by time) or removing vote if clicking on the same vote type again. For example if user clicks on like button for the…