Skip to content

Instantly share code, notes, and snippets.

View daveespionage's full-sized avatar

David Cox-Espenlaub daveespionage

View GitHub Profile
@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();
@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
@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;
}
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
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'];