How to capture email addresses using Analytics

For an upcoming project of mine - learnchinesegym.com - I wanted a ‘soon-to-be-launched’ page with a simple sign up form through which users could submit their email addresses in order to be notified of updates. Typically, unless one already has t...

How to check if a JPEG is progressive

I’m trying to optimise my JPEGs so that they’re progressive. That way they will appear to load quicker for visitors to my website. This practise seems to be gaining steam recently. In fact, remember in the late 90’s when computers and internet spe...

How to wrap fs.exists() within a Promise

I have started using the Q module - an implementation of the Promises specification. One nifty function it provides is denodify. This makes it easy to convert a Node.js function (which takes a normal callback) into one which returns a Promise. All...

Mocking calls to a class constructor in Javascript

The other day, whilst writing tests with SinonJS I realised that there was no obvious way of mocking calls to class constructors in Javascript. A quick search for “mocking Javascript class constructor” did lead me to some helpful answers.