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
window._bounce1 = function(p){ | |
var value; | |
for (var a = 0, b = 1; 1; a += b, b /= 2){ | |
if (p >= (7 - 4 * a) / 11){ | |
value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2); | |
break; | |
} | |
} | |
console.log('n = ', Math.log(b)/Math.log(0.5), 'a = ', a, 'b = ', 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
if(!console) | |
console = {}; | |
if(!console.log) | |
console.log = $jb._log; | |
console.time = $jb._timerBegin; | |
console.timeEnd = $jb._timerEnd; | |
var i, n = 3000000; |
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() | |
{ | |
var _fnMap = {}; | |
$.fn.addClass = function(classes) | |
{ | |
var vs = this; | |
if(!(classes > '') || vs.length == 0) | |
return this; |
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
jQuery.fn.hasBind = function(type, _fn) | |
{ | |
var data, eventsMap, events; | |
if(!((data = this._data()) && (eventsMap = data.events) && (events = eventsMap[type]))) | |
return false; | |
var event, i = -1; while((event = events[++i]) && event.handler !== _fn) | |
; | |
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 _fn = (function() | |
{ | |
var re = /\d/; | |
return function(s) | |
{ | |
return Math.random() + re.test(s); | |
}; | |
})(); |
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
// you can run it at http://bga.github.com/speedtest/ | |
var _fn = (function() | |
{ | |
var re = /\d/; | |
return function(s) | |
{ | |
re.test(s); | |
}; |
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 i, n = 300000, a; | |
console.time("1"); | |
i = n; while(i--) | |
{ | |
a = []; | |
} | |
console.timeEnd("1"); | |
console.time("2"); |
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 _restoreSymbol = (function($G) | |
{ | |
var iframe = document.createElement('iframe'); | |
(document.body || document.documentElement).appendChild(iframe); | |
iframe.style.display = 'none'; | |
var win = iframe.contentWindow, doc = win.document; | |
doc.open(); |
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($G) | |
{ | |
var _wrap = function(Class) | |
{ | |
var _toString = Class.prototype.toString; | |
Class.prototype.toString = function() | |
{ | |
console.error('stack trace\n' + (this.stack || '/* no stack trace */')); |
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() | |
{ | |
var sys = require('sys'), | |
http = require('http'), | |
fs = require('fs'), | |
Script = process.binding('evals').Script; | |
var extToMimeMap = | |
{ | |
'.txt': 'text/plain', |