Unicorns are way better than document.getElementById();

So its safe to say I haven’t kept up with the latest in all things javascript.

The last time I did front end development on the scale im doing at the moment it was way back in 2004 for a website that is still very much how I left it… VPlanet.org.  Ahh Just looking at that site instantly takes me back to web 1.0 :).   Back then I was in with the best of us with the cutting edge in Javascript.. ..  That is to say I felt cool because none of the other web devs were using document.getElementById() and I was rocking it hardcore with that as my primary weapon and my shiny new XHTML doctype… fucking STRICT mode dudes… strict mode… I even had the ‘validates’ badge from w3C that only the cool kids had.

Anyway fast forward nearly a decade and who’s the cool kid now…  It’s very much John Resig.

I have the biggest hard on for javascript right now.. dollar signs, closures.. yayQuery podcast… jeez i cant get enough of this stuff… My main problem right now is its way too fucking short and easy to write code! one liners are like hits of crack.. they don’t last..fuck you dollar sign, fuck you.

I wanna get my teeth in a serious web app… luckily I’m making one for work :).

Anyway lets follow Paul Irish’s example and make some unicorns up in this thing…

Add me some unicorns….

var Unicorns = function($) {
function getScript (url, callback) {
var head= document.documentElement,
script = document.createElement("script");
script.src = url;
var done= false;
script.onload = script.onreadystatechange = function() {
if ( !done && (!this.readyState ||
this.readyState === "loaded" || this.readyState === "complete") ) {
done = true;
head.insertBefore(script , head.firstChild );

getScript(‘http://www.cornify.com/js/cornify.js’, function() {

$(“#unicorn”).bind(“click”, function(event) {
gayForPaulIrish = Math.floor(Math.random() * 12 );
while (–gayForPaulIrish) cornify_add();

Code for this is as above :)
Thanks guys !