Skip to content

Instantly share code, notes, and snippets.

View edankwan's full-sized avatar

Edan Kwan edankwan

View GitHub Profile
@edankwan
edankwan / poop.js
Last active August 29, 2015 14:15 — forked from elsassph/poop.js
Array.prototype.poop = function() {
this.pop();
// return nothing, it's poop
}
Array.prototype.shit = function() {
this.shift();
// return nothing, it's shit
}
;(function(Modernizr, window) {
Modernizr.addTest('positionfixed', function () {
var test = document.createElement('div'),
control = test.cloneNode(false),
fake = false,
root = document.body || (function () {
fake = true;
return document.documentElement.appendChild(document.createElement('body'));
}());
/* modernizr-test_position_fixed_ios.js
* Original by Daniel Ott (https://gist.github.com/1333800)
* 3 March 2011
* Updated by Philipp Söhnlein 3 November 2011
* Custom Tests using Modernizr's addTest API
*/
/* iOS
* There may be times when we need a quick way to reference whether iOS is in play or not.
* While a primative means, will be helpful for that.
@edankwan
edankwan / build.js
Created October 26, 2012 15:00 — forked from millermedeiros/build.js
sample node.js build script including RequireJS optimizer (r.js) and copy/delete/filter files
// Combine JS and CSS files
// ---
//
// Make sure you install the npm dependencies
// > cd YOUR_PROJECT_FOLDER
// > npm install
//
// Than run:
// > node build
@edankwan
edankwan / lzw_encoder.js
Created October 24, 2012 21:44 — forked from revolunet/lzw_encoder.js
LZW javascript compress/decompress
// LZW-compress a string
function lzw_encode(s) {
var dict = {};
var data = (s + "").split("");
var out = [];
var currChar;
var phrase = data[0];
var code = 256;
for (var i=1; i<data.length; i++) {
currChar=data[i];
@edankwan
edankwan / rAF.js
Created October 22, 2012 17:17 — forked from paulirish/rAF.js
Javascript - requestAnimationFrame polyfill
// 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
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {