Dealing with process signals with Node.js

JavaScript is asynchronous but we sometimes forget that it’s single threaded. This can be a problem when dealing with signals.

Read more

Internet Explorer 5 still lives

There was a time where Chrome didn’t exist and IE was ruling the web world.

Back in this day, it was common for browsers to take liberty and implement some shortcuts.

For example, IE5 automatically defined a global event property that contained the event that was triggered so that when executing event callbacks, the user didn’t have to do anything and so the following code would work.

What you may not know is that this code still works in Chrome 63, some 18 years later!

Internet Explorer is still alive :)

Let’s wish Chrome won’t take that much liberties…

Read more

How to set Content-Type header for specific URIs using Apache RewriteRule

I was working on an HTML 5 application that loads & plays MP4 files and noticed that some older version of Firefox simply refuse to load media files, although their codec is supposed to be supported.

Read more

Webpack: here are a few tricks that can boost your build performance

Webpack is a nice tool but the default configuration can be very slow at generating builds, even for small projects. Fortunately it takes only a few modifications to drastically reduce build times.

Read more

Migrating from Jasmine 1.3 to Jasmine 2.0

If you just started a new JavaScript project with Jasmine, you likely started using Jasmine 2. But if you’re working on an existing project, it’s highly possible you’re using Jasmine 1.3 and maybe want, like me, migrate to Jasmine 2. Here are a few tips how to do it.

Read more

Finding a process using a specific network port with the lsof command

Today I could not launch a node server: the port my app was targeted was already in use. Fortunately Unix comes with very handy command line tools when it comes to finding which processes are using a specific port/address.

Read more

Ping a server from a grunt task

I was working on a small project that sets up a proxy using grunt, and then starts a node server. Problem is that if the proxy wasn’t up and running, grunt would still start the server and any call to the proxy would make the grunt server crash with some unrelated error.

I decided to add a simple task that would ping the proxy server, and simply fail with an explicit error if it wasn’t responding.

Read more

Getting to know display:flex

I know I’m late, but I have finally been toying with the new CSS 3 display modes like flex and I’m already running into trouble.

It seems there are a lot of inconsistencies across browsers which makes me wonder if it’s ready to be used.

Read more

Optimising the Canvas HTML5 element

While developing my own tile/sprite drawing engine, I stumble upon several problems related to the Canvas element: I thought it would be a good idea to share my experiences.

Read more

Node.js: production management with PM2

It’s real easy to come with having your site running with Node.js: simply start it with “node server.js” and here you go.
But what if you wanted to take advantage of the multiple cores of your server ? What about log aggregation ? What about process management ?
Well, none of these are easy to deal with.

There were already some useful tools like nodaemon or node-forever but unfortunately, these tools are either not ready for production environment, or lack process-mangement/cluster support.

This was a problem before PM2!

Read more