A Range Minimum Query solution in Javascript

I've been taking a few codility tests lately and I've hit a very interesting problem dealing with prefix sums. Basically, the problem is to find the minimal nucleotide from a range of sequence DNA. Full problem is here. If you're into algorithms, I suggest you try it out. The solution…

Deploying a static site to Heroku with Grunt

Heroku is awesome like bacon. You may love or hate the fact that they use git for deployment automation, but git is awesome like bacon too right? Suppose you're deploying a static web page on Heroku. You'll have a bunch of things to do first like minifying your javascript and…

The classic JavaScript block scope WTF

There comes a time in every programmer's life, when they have to work with javascript. The more unlucky ones coming from their upbringing in the more "complete" languages like Python, Java (sure, could have happened like 10 years ago), C# or C++, would write something like this. for (var i…

Setting up multiple worker processes for your node server

Node runs on a single thread. And many implementations won't need anything more than this, if they just stick to the optimum use case for node - which is handling non-CPU intensive stuff. But suppose you want to push node beyond the default singleton server it is. Here's how you…

Creating a HTTPS proxy in Node.js

Recently, I needed to mock a dev box to act as the production environment to do some debugging on a Node.js express web app. The problem was that the calls that are received by the said dev box are all HTTPS, (hence received on port 443) and in the…