Skip to content

Instantly share code, notes, and snippets.

David DeSandro desandro

Block or report user

Report or block desandro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View auto-cornify.js
// add event helper
function addEvent( obj, type, fn ) {
if ( obj.addEventListener ) {
obj.addEventListener( type, fn, false );
} else if ( obj.attachEvent ) {
obj.attachEvent( "on" + type, fn );
}
}
function cornifyThisGuy() {
@desandro
desandro / jquery-layout-review.md
Created Jan 28, 2013
layout thrashing in jQuery
View jquery-layout-review.md
@desandro
desandro / classie.js
Last active Nov 9, 2017
classie - class helper functions
View classie.js
/*!
* classie - class helper functions
* from bonzo https://github.com/ded/bonzo
*
* classie.has( elem, 'my-class' ) -> true/false
* classie.add( elem, 'my-new-class' )
* classie.remove( elem, 'my-unwanted-class' )
*/
/*jshint browser: true, strict: true, undef: true */
View round-svg.js
var paths = document.querySelectorAll('path')
for ( var i=0; i < paths.length; i++ ) {
var path = paths[i];
var d = path.getAttribute('d');
// 10.2.3 -> 10.2 0.3
d = d.replace( /(\d?\.\d)\.(\d)/g, function( match, $1, $2 ) {
return $1 + ' 0.' + $2
});
// round numbers
View calebs-first-code.txt
uijjkjn bnnbbv 7nbgn7uy8mh vb hx vghb Z bv VB Aszxsew2W
sxez3w axzas bf71b 1vfu1ch bc bgb7nvi 76r g `cxzfbc cv
dfgv n 1 2q1
View penrose.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@desandro
desandro / elephant.svg
Created Feb 24, 2017
overprint elephant
View elephant.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@desandro
desandro / README.md
Created Sep 24, 2013
imagesLoaded + requireJS
View README.md

Install imagesLoaded via Bower

bower install imagesloaded

The config in main.js can be set up several ways

requirejs.config({
  // set paths object
  paths: {
@desandro
desandro / doit.js
Created Jun 28, 2011
Pretty Beautiful Javascript
View doit.js
(function(){
var pres = document.getElementsByTagName('pre');
if ( !pres.length || document.body.querySelectorAll('*').length !== 1 ) {
return;
}
// Copyright (C) 2006 Google Inc.
//
@desandro
desandro / requestanimationframe.js
Created Feb 19, 2012 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
View requestanimationframe.js
/**
* requestAnimationFrame polyfill by Erik Möller & Paul Irish et. al.
* https://gist.github.com/1866474
*
* http://paulirish.com/2011/requestanimationframe-for-smart-animating/
* http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
**/
/*jshint asi: false, browser: true, curly: true, eqeqeq: true, forin: false, newcap: true, noempty: true, strict: true, undef: true */
You can’t perform that action at this time.