window.dbg = (obj) -> $('body').append('
'+JSON.stringify(obj, null, '\t')+'
') window.dbg3 = (obj) -> $('body').append('
'+obj+'
') window.dbg2 = (node) -> tmpNode = document.createElement( "div" ) tmpNode.appendChild( node.cloneNode( true ) ) str = tmpNode.innerHTML tmpNode = node = null escapedStr = str.replace( "<" , "<" ).replace( ">" , ">") $('body').append('
'+escapedStr+'
') $.fn.serializeObject = () -> o = {} a = this.serializeArray() $.each(a, () -> if (o[this.name] != undefined) if (!o[this.name].push) o[this.name] = [o[this.name]] o[this.name].push(this.value || '') else o[this.name] = this.value || '' ) return o window.sticky = () -> y = $(window).scrollTop() if y > $('header').height() height = $('nav.topbar').css({ 'position': 'fixed' 'top': '0' 'width': $('#page').width() 'box-shadow': '0px 20px 20px -15px #CCC' }).height() $('#container').css({ 'padding-top': height }) else $('nav.topbar').removeAttr('style') $('#container').removeAttr('style') String.prototype.model = () -> return can.capitalize( this.replace( /[-_]([a-z])/ig, (z,b) -> return b.toUpperCase() ))