Skip to content

Instantly share code, notes, and snippets.

View daveespionage's full-sized avatar

David Cox-Espenlaub daveespionage

View GitHub Profile
@paulirish
paulirish / rAF.js
Last active November 11, 2024 03:20
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
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@weisjohn
weisjohn / gist:1895291
Created February 23, 2012 22:01
a simple jQuery based ticker
// a simple utility function for pretty printing
function pad(number, length) {
var str = '' + number;
while (str.length < length) {
str = '0' + str;
}
return str;
}
@weisjohn
weisjohn / tounch_munge.js
Created March 19, 2012 14:42
basic touch/mouse events + munging
// feature detection
isTouch = "ontouchstart" in window;
InputHandler = {
startEventType : isTouch ? "touchstart" : "mousedown",
moveEventType : isTouch ? "touchmove" : "mousemove",
endEventType : isTouch ? "touchend" : "mouseup",
isTouchDevice : isTouch,
// normalize an event object generated by a select
@ElliotChong
ElliotChong / addInheritance.js
Created September 4, 2012 18:13
Add inheritance to JavaScript
(function ()
{
if (!Function.prototype.inherit)
{
Function.prototype.inherit = function (p_parent)
{
if (p_parent.constructor == Function)
{
// Normal Inheritance
this.prototype = new p_parent();