Archive image

Archive for December, 2013

Trouble installing mysql2 gem on Windows 8 with Ruby2

I recently installed the 64 bit version of Ruby 2.0 on my Windows 8 machine.

All of my old projects I tested with it ran just fine and the world was a happy place.

Then I had to install Rails, so that I could make some minor changes to an existing app … and the pain began.

Read more…

How to center an HTML Element using JavaScript

Imagine you have an element which is dynamically added to your web page (an image in a lightbox, for instance) and you want to centre it on the screen both horizontally and vertically.

You could do so with CSS (as this article explains), but if you don’t know the dimensions of the element you want to centre or you need to support older browsers, things can become quite tricky quite quickly.

That’s when you should think about doing the job with JavaScript.

Read more…