I don’t normally write code that I’m not ready to use, but I made an exception for this jQuery plugin. It doesn’t really do all that I wanted it to do, but it’s good enough for a release.
Read the rest of this entry »
Archive for December, 2008
jQuery zoom event plugin
On December - 11 - 2008
The start of a jQuery zoom event handler
On December - 11 - 2008
After much research and very little code, I’ve come up with a basic start to a jQuery zoom event handler. Don’t laugh. This is very basic, but it handles zoom events based on keyboard shortcuts and fires the handler.
Read the rest of this entry »
Simple date conversion from SQL to readable
On December - 2 - 2008
I needed a simple date converter function from SQL dates (YYYY-MM-DD) to something readable (M/D/YYYY). So I wrote this little function. Maybe someone else will have some use for it.
var makeSQLDatePretty = function(d) {
return d.replace(/([0-9]{4})-0?([0-9]{1,2})-0?([0-9]{1,2})/, '$2/$3/$1');
};
return d.replace(/([0-9]{4})-0?([0-9]{1,2})-0?([0-9]{1,2})/, '$2/$3/$1');
};
Pass in a SQL date and the function trims leading zeros and returns a reformatted date.
var sqlDate = '2008-12-02';
alert(makeSQLDatePretty(sqlDate)); // should alert '12/2/2008'
alert(makeSQLDatePretty(sqlDate)); // should alert '12/2/2008'
Crazy Europeans may want to change the replace regex with ‘$3/$2/$1′.