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
var encapsulate = (function() | |
{ | |
var rGetFirstChar = /^([a-z])/; | |
function isNumber (value) | |
{ | |
return !isNaN(parseFloat(value)) && typeof value !== 'string'; | |
} |
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 class creation library. | |
// Inspired by base2 and Prototype | |
(function(){ | |
var initializing = false, | |
// Determine if functions can be serialized | |
fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; | |
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 _keyEventWasDataEntry (e) | |
{ | |
var key = e.charCode, | |
keychar = String.fromCharCode(key); | |
// Return false if key was; | |
// 9 tab | |
// 8 backspace | |
// 16 shift |
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 functionQueue (aFunctions, nSecondsInterval) | |
{ | |
var _queue = [], | |
_arguments = [], | |
i, | |
oSelf = this; | |
nSecondsInterval = nSecondsInterval * 1000; |
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
javascript:(function(oSubject){var%20key,arr%20=%20[],obj%20=%20{},i;for%20(key%20in%20oSubject){arr.push([key,%20oSubject[key]]);}arr.sort();for%20(i%20=%200;%20i%20<%20arr.length;%20i++){obj[arr[i][0]]%20=%20arr[i][1];}console.log(obj);}%20(eval(prompt(%27Enter%20reference%20to%20Object%27))));void(0); |
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.prototype.join = function (separator, template) | |
{ | |
var key | |
, output = [] | |
, length = 0 | |
, self = this | |
, tKey = '{key}' | |
, tValue = '{value}'; | |
separator = separator || ','; |
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 AsyncGroup () | |
{ | |
this.members = []; | |
this.callbacks = []; | |
AsyncGroup.statics.init.apply(this, arguments); | |
} | |
// statics used for utils to keep the instance API clear | |
AsyncGroup.statics = { | |
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 average (arr) | |
{ | |
return _.reduce(arr, function(memo, num) | |
{ | |
return memo + num; | |
}, 0) / arr.length; | |
} |
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 partial(fn) { | |
var fixed = [].slice.call(arguments, 1); | |
return function() { | |
return fn.apply(this, fixed.concat([].slice.call(arguments, 0))); | |
}; | |
} |
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 write () | |
{ | |
foreach (func_get_args() as $value) { | |
echo $value . '<br />\n\r'; | |
}; | |
} | |
write('this', 'is', 'a', 'quick', 'and', 'dirty', 'logger'); |