1. Reactive Programming in a nutshell

    What is Reactive Programming? Just like many things involving programming, there are a varying degree of answers to this question. So let's start with the simple one: Reactive Programming is programming in a way where changes throughout the system are propagated to other parts of the program over a period…


  2. Assigning a variable using a switch statement in Javascript

    Here's a simple trick to assign a variable using a switch statement in Javascript. It uses IIFE pattern (http://benalman.com/news/2010/11/immediately-invoked-function-expression/). Put simply, it looks like this: var price = (function(color) { switch(color) { case 'red': return 10; case 'blue': return 20; default: return 30; } })('blue'); console.…

    on javascript node.js

  3. How I Structure RESTful APIs using Express 4

    Ruby on Rails had it all, maybe too much of it. By it, I mean the rails magic. But one thing that was really useful is its strict, clear and concise definition and use of its directory structure. This took care of most boilerplate code and all you had to…


  4. Setting up Express.js to Parse JSON body by default

    Sometimes you might have a client need to assume that they are always making requests with JSON body, without necessarily putting Content-Type header in their requests. //In your main index.js (or wherever you initialize express) var app = express(); //Using Express 4.x app.use(bodyParser.json({ type: '*/*'}…

    on node.js express.js javascript

  5. Visualizing Glitter?

    Sorry guys, I mistakenly put glitter in the URL. The updated article can be found here http://www.codekitchen.ca/visualizing-glimmer-performance/…