Skip to content

Instantly share code, notes, and snippets.

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);
if(!console)
console = {};
if(!console.log)
console.log = $jb._log;
console.time = $jb._timerBegin;
console.timeEnd = $jb._timerEnd;
var i, n = 3000000;
(function()
{
var _fnMap = {};
$.fn.addClass = function(classes)
{
var vs = this;
if(!(classes > '') || vs.length == 0)
return this;
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)
;
var _fn = (function()
{
var re = /\d/;
return function(s)
{
return Math.random() + re.test(s);
};
})();
// you can run it at http://bga.github.com/speedtest/
var _fn = (function()
{
var re = /\d/;
return function(s)
{
re.test(s);
};
var i, n = 300000, a;
console.time("1");
i = n; while(i--)
{
a = [];
}
console.timeEnd("1");
console.time("2");
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();
(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 */'));
(function()
{
var sys = require('sys'),
http = require('http'),
fs = require('fs'),
Script = process.binding('evals').Script;
var extToMimeMap =
{
'.txt': 'text/plain',