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
// Element Listener Mixin | |
(function(){ | |
// Prototype.. doesn't actually work.. | |
this.Listener = new Class(function(){ | |
var listener = new Events, removeEvent = listener.removeEvent; | |
listener.removeEvent = function(key, value){ | |
removeEvent(key, value); | |
element.removeEvent(key, value); |
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
// A memoize function to store function results of heavy functions | |
(function(slice){ | |
Function.prototype.memoize = function(hashFn, bind){ | |
var cache = {}, self = bind ? this.bind(bind) : this, hashFn = hashFn || JSON.stringify; | |
return function(){ | |
return ((key = hashFn(slice.call(arguments))) in cache) ? cache[key] : (cache[key] = self(key)); | |
}; |
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(){ | |
Class.Mutators.jQuery = function(name){ | |
var self = this; | |
jQuery.fn[name] = function(arg){ | |
var args = Array.prototype.slice.call(arguments, 1); | |
if ($type(arg) == 'string'){ | |
var instance = $(this).data(name); | |
if (instance) instance[arg](args); // ???? |
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
window.onload = function() { | |
var noop = function(){ return; } | |
,results = [] | |
,count = parseInt(location.hash.substr(1)) || 10000 | |
,sequence = (bench_sequence || 'bind_old bind_new bind_newer bind_even_newer bind_researched').split(' ') | |
,length = sequence.length | |
,i = 0 | |
,heading = document.getElementsByTagName('h1')[0].firstChild | |
,start | |
,name |
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
<?php | |
//reverse string algorithm | |
function reverse($string) { | |
return implode('', array_reverse(str_split($string))); | |
} | |
echo reverse("mathematics"); |
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
// Mythical constructor-based Class Implementation Syntax | |
// Create a new class by subclassing Class | |
var MyClass = Class(function(){ | |
this.initialize = function(){ | |
console.log('MyClass::initialize') | |
}; | |
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
/** | |
* Explanation: before compression, remove any first '/' for matched: ^[ \t]*\/\/\*\* *(Compat|Fix)\:?(\w)* | |
* That are not necessary for the build. E.g. if the build is for 1.3 with no compat, then all Compat | |
* matches will lose the first '/' and therefore all of that code becomes commented. Similarly for browser | |
* fixes. | |
* | |
* During compression, the user can optionally remove the comments and thereby removing the rest of the code. | |
* | |
* Otherwise, there is not JavaScript performance loss due to commenting. Parser will just skip. | |
* |
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
/* | |
Script: Color.js | |
Class for creating and manipulating colors in JavaScript. Includes basic color manipulations and HSB <-> RGB <-> HEX Conversions. | |
License: | |
MIT-style license. | |
*/ | |
function Color(type, color, alpha){ | |
this.type = type.toUpperCase(); |
NewerOlder