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 randomAlphaNum = function () { | |
var alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' | |
return alpha[Math.round(Math.random() * alpha.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
// http://hashify.me/ | |
var B64 = function(){ | |
encode: function (raw) { | |
return window.btoa( window.unescape( encodeURIComponent(raw) ) ); | |
}, | |
decode: function (b64) { | |
return decodeURIComponent( window.escape( window.atob(b64) ) ); | |
} | |
}; |
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
/** | |
* Class | |
* A class factory | |
*/ | |
function Class(parent, members) { | |
// prepare single-inheritance | |
members = members || parent; |
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
/*! | |
* snake.js 0.0.1 - https://gist.github.com/yckart/5320382/ | |
* A super simple canvas snake game to port into some game-engines. | |
* | |
* Copyright (c) 2013 Yannick Albert (http://yckart.com) | |
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php). | |
* 2013/04/05 | |
*/ | |
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
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// refactored by Yannick Albert | |
// MIT license | |
(function(window) { | |
var equestAnimationFrame = 'equestAnimationFrame', | |
requestAnimationFrame = 'r' + equestAnimationFrame, |
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 (performance) { | |
performance.now = performance.now || | |
performance.webkitNow || | |
performance.msNow || | |
performance.mozNow || | |
Date.now || function () { | |
return new Date().getTime(); | |
}; | |
}(this.performance = this.performance || {})); |
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.addrule.js 0.0.2 - https://gist.github.com/yckart/5563717/ | |
* Add css-rules to an existing stylesheet. | |
* | |
* @see http://stackoverflow.com/a/16507264/1250044 | |
* | |
* Copyright (c) 2013 Yannick Albert (http://yckart.com) | |
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php). | |
* 2013/11/23 | |
**/ |
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
/** | |
* Hide the addressbar on ios & android devices | |
* https://gist.github.com/yckart/5609969 | |
* | |
* Based on the work from Nate Smith | |
* @see https://gist.github.com/nateps/1172490 | |
* | |
* Copyright (c) 2013 Yannick Albert (http://yckart.com) | |
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php). | |
* 2013/07/10 |
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 nthChild = function (elem, num, fn) { | |
var len = elem.length; | |
var ret = []; | |
var i = 0; | |
// :nth-child(num) | |
if (!isNaN(Number(num))) { | |
for (i = 0; i < len; i++) { | |
if (i === num - 1) { | |
if (fn) fn(elem[i]); |