Stream vs Promise Asynchronicity

I recently hit a stumbling block whilst testing asynchronous javascript. My code needed to make a call to the server from the browser, so I decided to use a Promise as an abstraction in order to stub it out. I chose the bluebird library, as it’s incredibly popular, performant and adheres to the Promises/A+ spec. Unfortunately […]

Fun with parser combinators

Parser combinators are essentially a neat and powerful way of declaratively writing a parser, which could be used for writing your own programming language, or DSL. You make small parsers that act like building blocks and then combine them to create more complex parsers until you have one that encompasses them all. There are quite a few parser libraries, so you can […]

Enabling https in a node js app on windows

Whilst developing my knockout dependency tracking application I realised I had to support access to it over https instead of http. This is because the website we’re currently developing and all of the web services it talks to are secured via federated identity. Ideally we would be able to simply flick a switch to use http during development, but […]

Testing asynchronous JavaScript

By making AJAX calls directly to the server from your JavaScript view-model it can be impossible to get the code under test. A simple solution is to fake the calls and make them synchronous. This example view-model for a library takes a function that will make a call to the server to check out a book […]