Fuel Poverty in England (2011)

Using the government’s Open Data, and the constituency boundaries provided by MapIt, I’ve been analysing the distribution of fuel poverty in England (since this seems to be on all the party’s agendas nowadays).


Port Forwarding In Linux

For reasons which I will not go into for fear of boring everyone, we were trying to forward local requests on port 80 to port 3000 (running a Rails app), without booting the Rails app on port 80, and without having a web server in the middle to do the redirection.


Upgrading Rails Engines to Rails 3.2

Wtih the recent release of Rails 3.2, we have been trying to upgrade all our engines at Sage to use Rails 3.2. Everything works great, except scaffolding.


Testing Rails Engines With Rspec

After my lightning talk at Ruby North East, a couple of people asked me how to go about getting set up with an engine with RSpec as the testing framework. We’ve automated this at Sage, but here’s what’s necessary.


TimThumb Hack Check Script

I was recently a victim of the timthumb vulnerability. At first I noticed some rogue PHP in all my index.php files, which I cleaned up. But it turned out they had already got in enough to re-hack in no time at all. This time it was my javascript files which all had some obstruficated code in them, causing every page load to make a request to some random site.


Rails 3.1 replacement for filter_chain

In previous versions of rails, you could do MyController.filter_chain to get an object representing the filters on a controller.


Bundle Install Git Post Merge Hook

Who wants to type “bundle install” all the time? Not me, that’s who!


Rails 3 counter_cache with has_many :through

After an evening of getting knee deep in the Rails core debugging and issue with counter_cache on a has_many :through, it seems this has been reported on lighthouse, and a fix has been applied in edge.


CakePHP pagination and filtering

Here’s another little trick in CakePHP — it’s quite often that someone will request a big old list of paginated data, along with filters on that data.


Rubix Cube 5x5 Parity Algorithm

Nothing to see here, just an aid to memory: