Archive for the ‘Web’ Category

jQuery Classes – An Object Oriented Approach

Tuesday, April 14th, 2009

MooTools has been my framework of choice for the past couple of years. I've worked my way up to using Classes for most of my projects and really liked using the OOP approach. For the past couple of projects, I started using WordPress as my CMS and every time ended up using jQuery. I was disappointed to find out that it didn't have the native Class library that MooTools did. Fortunately there is a plugin available to assist with this task:

- A plugin that adds class functionality to jQuery: jQuery-Klass

New BBC Radio 1 RTSP Stream Format

Saturday, February 14th, 2009

Every week or two I rip some new music from Radio 1 for my IPod Nano w/RockBox firmware (had to throw that in). It looks like they've changed the stream URL format. They used to use the DJ's name in the URL, but now they are using the day of week and show time. Here's a couple examples.

Pete Tong:

Fabio and Grooverider:

JavaScript ISO8601/RFC3339 Date Parser

Saturday, November 1st, 2008

Updated (bug fix): 2-11-09

In need of a JavaScript function that would parse an ISO8601 compliant date, I came across an attempt ( and rewrote it (because I'm all about reinventing the wheel). My function extends the Date object and allows you to pass in an ISO8601 date (2008-11-01T20:39:57.78-06:00). The function will then return the Date. In the date string argument the dashes and colons are optional. The decimal point for milliseconds is mandatory (although specifying milliseconds isn't). If a timezone offset is specified, the '+' or '-' sign must be included. This function should also work with iCalendar(RFC2445) formatted dates. If a the date string doesn't match the format, there will be a final attempt to parse it with the built in Date.parse() method.


Date.prototype.setISO8601 = function(dString){

var regexp = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))/;

if (dString.toString().match(new RegExp(regexp))) {
var d = dString.match(new RegExp(regexp));
var offset = 0;

this.setUTCMonth(parseInt(d[3],10) - 1);
if (d[12])
this.setUTCMilliseconds(parseFloat(d[12]) * 1000);
if (d[13] != 'Z') {
offset = (d[15] * 60) + parseInt(d[17],10);
offset *= ((d[14] == '-') ? -1 : 1);
this.setTime(this.getTime() - offset * 60 * 1000);
else {
return this;


var today = new Date();