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
// @license WTFPL | |
Array.prototype.search = function (some) { | |
return function search(cb, ctx) { | |
var result = {f:cb, c:ctx, r:result}; | |
this.some(some, result); | |
return result.r; | |
}; | |
}(function some(v, i, self) { | |
if (this.f.call(this.c, v, i, self)) { | |
this.r = v; |
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 Queue(q) {"use strict"; | |
// (C) WebReflection - Mit Style License | |
var | |
next = function next() { | |
return (callback = q.shift()) ? !!callback(q) || !0 : !1; | |
}, | |
callback | |
; | |
(q.wait = function wait(condition, delay) { | |
condition || callback && q.unshift(callback); |
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 (window) {"use strict"; | |
// by WebReflection - WTFPL License | |
var | |
prefixes = "r webkitR mozR msR oR".split(" "), | |
process = "process", | |
nextTick = "nextTick", | |
i = 0, | |
p = window[process] || (window[process] = {}) | |
; | |
while (!p[nextTick] && i < prefixes.length) |
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(Object, getPropertyDescriptor, getPropertyNames){ | |
// (C) WebReflection - Mit Style License | |
if (!(getPropertyDescriptor in Object)) { | |
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | |
Object[getPropertyDescriptor] = function getPropertyDescriptor(o, name) { | |
var proto = o, descriptor; | |
while (proto && !( | |
descriptor = getOwnPropertyDescriptor(proto, name)) | |
) proto = proto.__proto__; | |
return descriptor; |
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
/*! (C) WebReflection - Mit Style License */ | |
(function(FunctionPrototype){ | |
var | |
bind = FunctionPrototype.bind || function () { | |
var callback = this; | |
return function bind() { | |
return callback.apply(this, arguments); | |
}; | |
}, | |
call = FunctionPrototype.call |
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
var isArguments = function(toString){ | |
// (C) WebReflection - Mit Style License | |
var compare = toString.call(arguments); | |
return ~compare.indexOf("Arguments") ? | |
function isArguments(object) { | |
return toString.call(object) == compare; | |
} : | |
(compare = toString.call([])) && | |
function isArguments(object) { | |
try { |
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 loop(e) { | |
if (e.type == 'mousedown') loop.move = true; | |
if (e.type == 'mouseup') loop.move = false; | |
if (loop.move) move(e); | |
} | |
$('#box').mousedown(loop); | |
$(window).mousemove(loop) | |
.mouseup(loop); |
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
var loop = coroutine(function loop(e) { | |
// could be outer scope moving variable too | |
// so that woul dbe shared within generators | |
loop.moving = 0; | |
while (yield e) { | |
if (e.type == 'mousedown') { | |
loop.moving++; | |
while (e = yield) { | |
if (e.type == 'mousemove') | |
move(e); |
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
/*!(C) WebReflection *//** @license Mit Style */ | |
// inspired by https://gist.github.com/4395291 | |
this.inherit || (this.inherit = function(create){ | |
if (!create) { | |
if ({__proto__:null} instanceof Object) { | |
for (var | |
Null = function Null() {}, | |
doc = document, | |
html = doc.documentElement, | |
iframe = html.insertBefore( |
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
this.forIn = function (){ | |
var | |
propertyIsEnumerable = "propertyIsEnumerable", | |
toString = "toString", | |
OK = {toString:1}[propertyIsEnumerable](toString), | |
keys = OK || [ | |
propertyIsEnumerable, | |
toString, | |
"hasOwnProperty", | |
"isPrototypeOf", |