This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
js> isNaN(null); | |
false | |
js> null > -1; | |
true | |
js> null < 1; | |
true | |
js> null > 0; | |
false | |
js> null < 0; | |
false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// makeClass - By John Resig (MIT Licensed) | |
function makeClass(){ | |
return function(args){ | |
if ( this instanceof arguments.callee ) { | |
if ( typeof this.init == "function" ) | |
this.init.apply( this, args.callee ? args : arguments ); | |
} else | |
return new arguments.callee( arguments ); | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$.fn.floatingWidget = function () { | |
return this.each(function () { | |
var $this = $(this), | |
$parent = $this.offsetParent(), | |
$window = $(window), | |
top = $this.offset().top - parseFloat($this.css('marginTop').replace(/auto/, 0)), | |
bottom = $parent.offset().top + $parent.height() - $this.outerHeight(true), | |
floatingClass = 'floating', | |
pinnedBottomClass = 'pinned-bottom'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var Central = window.Central = {}; | |
var centralService = function(target) { | |
var listeners = {}; | |
target.listen = function(command, handler) { | |
listeners[command] = listeners[command] || []; | |
var i = 0; | |
while (i < listeners[command].length && listeners[command][i] != handler) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* (c)2006 Jesse Skinner/Dean Edwards/Matthias Miller/John Resig | |
* Special thanks to Dan Webb's domready.js Prototype extension | |
* and Simon Willison's addLoadEvent | |
* | |
* For more info, see: | |
* http://www.thefutureoftheweb.com/blog/adddomloadevent | |
* http://dean.edwards.name/weblog/2006/06/again/ | |
* http://www.vivabit.com/bollocks/2006/06/21/a-dom-ready-extension-for-prototype | |
* http://simon.incutio.com/archive/2004/05/26/addLoadEvent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://ejohn.org/apps/learn/#36 | |
function User(first, last){ | |
if ( !(this instanceof arguments.callee) ) | |
return new User(first, last); | |
this.name = first + " " + last; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.trim = function() { | |
var str = this, | |
whitespace = ' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000'; | |
for (var i = 0,len = str.length; i < len; i++) { | |
if (whitespace.indexOf(str.charAt(i)) === -1) { | |
str = str.substring(i); | |
break; | |
} | |
} | |
for (i = str.length - 1; i >= 0; i--) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// written by Dean Edwards, 2005 | |
// with input from Tino Zijdel, Matthias Miller, Diego Perini | |
// http://dean.edwards.name/weblog/2005/10/add-event/ | |
function addEvent(element, type, handler) { | |
if (element.addEventListener) { | |
element.addEventListener(type, handler, false); | |
} else { | |
// assign each event handler a unique ID | |
if (!handler.$$guid) handler.$$guid = addEvent.guid++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.method = function(name, func) { | |
this.prototype[name] = func; | |
return this; | |
}; |