This file contains 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
Object.defineProperty(Object, "extend", { | |
enumerable: false, | |
value: function extend(obj) { | |
Array.prototype.slice.call(arguments, 1).forEach(function(current) { | |
Object.getOwnPropertyNames(current).forEach(function(key) { | |
Object.defineProperty(obj, key, Object.getOwnPropertyDescriptor(current, key)); | |
}); | |
}); | |
return obj; | |
} |
This file contains 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
// deparam | |
// | |
// Inverse of $.param() | |
// | |
// Taken from jquery-bbq by Ben Alman | |
// https://github.com/cowboy/jquery-bbq/blob/master/jquery.ba-bbq.js | |
var isArray = Array.isArray || function(obj) { | |
return Object.prototype.toString.call(obj) == '[object Array]'; | |
}; |
This file contains 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(replace) { | |
var escape = [/[\-\[\]\/\\{}()*+?.^$|]/g, '\\$&']; | |
RegExp.Safe = function(pattern, flags) { | |
return new RegExp(replace.apply(String(pattern), escape), flags); | |
} | |
}(String.prototype.replace)); |
This file contains 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
/* | |
* A simple JavaScript inheritance system | |
* (Like Prototype's `Class.create()`, only without the crazy method wrapping and function decompilation) | |
* | |
* Usage | |
* var A = Class.create({ | |
* // `$init` is the constructor | |
* $init: function(x, y) { | |
* this.x = x; | |
* this.y = y; |