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
// usage: log('inside coolFunc',this,arguments); | |
// http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ | |
window.log = function(){ | |
log.history = log.history || []; // store logs to an array for reference | |
log.history.push(arguments); | |
if(this.console){ | |
console.log( Array.prototype.slice.call(arguments) ); | |
} | |
}; |
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
/* Easy Clearfix from HTML5 boilerplate : h5bp.com/css */ | |
/* Contain floats: h5bp.com/q */ | |
.clearfix:before, .clearfix:after { content: ""; display: table; } | |
.clearfix:after { clear: both; } | |
.clearfix { *zoom: 1; } |
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 local=function(a,u){return function(b,c){if(a===u)return;if(!c){try{return JSON.parse(a.getItem(b))}catch(d){}return a.getItem(b)}try{return a.setItem(b,JSON.stringify(c))}catch(d){}return a.setItem(b,c)}}(window.localStorage) |
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
// Delay function to call up on every keyup. | |
// Solution to this: http://stackoverflow.com/questions/1909441/jquery-keyup-delay | |
// jQuery 1.7.1 or up required * | |
jQuery.fn.keyupDelay = function( cb, delay ){ | |
if(delay == null){ | |
delay = 400; | |
} | |
var timer = 0; | |
return $(this).on('keyup',function(){ |
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
<style type="text/css"> | |
#loading{ | |
position:fixed; | |
top:0; | |
left:0; | |
width:100%; | |
height:100%; | |
background:#e6e6e6; | |
opacity:.8; |
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
// Simplest and fastest way to generate random hex color | |
// Taken from http://stackoverflow.com/questions/1484506/random-color-generator-in-javascript | |
var randomHexColor = function(){ | |
var color = '#', i = 5; | |
do{ color += "0123456789abcdef".substr(Math.random() * 16,1); }while(i--); | |
return color; | |
} |
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 invert plugin | |
// by paul irish | |
// some (bad) code from this css color inverter | |
// http://plugins.jquery.com/project/invert-color | |
// some better code via Opera to inverse images via canvas | |
// http://dev.opera.com/articles/view/html-5-canvas-the-basics/#insertingimages | |
// and some imagesLoaded stuff from me | |
// http://gist.github.com/268257 |
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
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<style type="text/css"> | |
html,body{ height:100%; background-color:#F6f6f6; margin:0; padding:0; overflow-y:scroll; } | |
div.wrapper{width: 960px; min-height:100%; margin:0 auto; position:relative; } | |
header{ height:73px; border-bottom:2px solid #222; } | |
header h1{ margin:0; font-family:cambria; line-height: 73px; } |
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
/* | |
log function for easy logging with multi parameter support | |
and printf like string substitution: check usage at bottom | |
Useful for iphone / ipad simulator where multi params not natively supported | |
Now also supports logging of DOM objects in iOS | |
*/ | |
window.log = (function(){ | |
var dom_log = function(obj){ | |
var name = obj.nodeName.toLowerCase(), |
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
// Uses Prototype Inheritance | |
Array.prototype.sortByProp = function(p){ | |
return this.sort(function(a,b){ | |
return a[p] > b[p] ? 1 : a[p] < b[p] ? -1 : 0; | |
}); | |
} | |
/* Usage - Example */ |