August 1st, 2008
If you get a 403 error when using proxypass on debian make sure you enable (a2enmod) the ‘proxy_http’ module as well as the ‘proxy’ module.
To send all request to a single mongrel instance use the following syntax:
<VirtualHost *>
DocumentRoot /var/www/yourwebsite
ProxyPass / http://localhost:4000/
ProxyPassReverse / http://localhost:4000/
<VirtualHost>
Posted in Uncategorized | No Comments »
July 28th, 2008
If you’re bored i would definitely recommend changing your car radio! The sound improvement is amazing and being able to connect an iPod instead of fumbling around for cds while trying to keep the car in a straight line is definitely worth it.

Make sure everything is well grounded and that the signal cables are far away from the power cables or else you get a horrible whine coming from the alternator, especially if you put a sub in the boot.

If you’ve got a Honda Civic 7th Gen 2000-2004 then this guide should help, It definitely helped me. Just watch out for the yellow cables, they are for the airbags and are best left well alone
(Oh.. and disconnect the negative battery lead, to be on the safe side)
Posted in Car | No Comments »
July 28th, 2008
The standard analytics code is only 400 bytes or so.. Spread over a few thousand pages that 400 bytes soon eats into your bandwidth costs.
Most of the sites i currently work on use jQuery to add additional functionality without being to obtrusive to people that have JavaScript turned off.
JavaScript has to be turned on for Google’s code to work! So we can safely inject the code when the page is fully loaded and clients that have JavaScript turned off will be none the wiser.
Place the following code into a site wide file that loads after jQuery and change the tracker code (gaTrackCode) to the one you received from analytics.
// google analytics tracking code
jQuery(document).ready(function($) {
var gaTrackCode = "UA-123456789";
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
jQuery.getScript(gaJsHost + "google-analytics.com/ga.js", function(){
var pageTracker = _gat._getTracker(gaTrackCode);
pageTracker._initData();
pageTracker._trackPageview();
});
});
Tags: analytics, jquery
Posted in Web Dev | 1 Comment »
April 13th, 2008
Simplify your code and stay DRY by wrapping commonly used commands in a block.
If you ever find your self writing ugly code like this:
db = Database.new
db.open
orders = db.fetch_orders
db.close
It may be worth looking at ruby’s block syntax so you can instead write:
Database.new do |db|
orders = db.fetch_orders
end
Just check if a block is given inside the initialize method and wrap it with the open and close method calls.
class Database
def initialize
if block_given?
open
yield self
close
end
end
def open
end
def close
end
def fetch_orders
end
end
Posted in Ruby | No Comments »