Skip to content

Instantly share code, notes, and snippets.

@getify
getify / gist:a523250a779d12993d99
Created September 30, 2014 11:56
hijacking clicks using "capturing phase" event handler
// hijack the next click anywhere
if (document.addEventListener) {
document.addEventListener("click",function handler(evt){
evt.preventDefault();
evt.stopPropagation();
evt.stopImmediatePropagation();
document.removeEventListener("click",handler,true);
/**
* 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
@adamesque
adamesque / preloader.js
Created February 16, 2011 23:38
Uses jQuery's new Deferred object to help with image loading
/**
* Helper function for passing arrays of promises to $.when
*/
jQuery.whenArray = function ( array ) {
return jQuery.when.apply( this, array );
};
/**
* Accepts a single image src or an array of image srcs.