Skip to content

Instantly share code, notes, and snippets.

View desandro's full-sized avatar

David DeSandro desandro

View GitHub Profile
@desandro
desandro / get-style-property.js
Created January 24, 2013 15:37
getStyleProperty
/*!
* getStyleProperty by kangax
* http://perfectionkills.com/feature-testing-css-properties/
*/
/*jshint browser: true, strict: true, undef: true */
( function( window ) {
'use strict';
@desandro
desandro / constructor-obj.js
Created December 24, 2012 15:13
how can I access Alpha.defaults from myAlpha?
function Alpha() {}
Alpha.defaults = { foo: 'bar' };
function Beta() {}
Alpha.prototype = new Beta();
var myAlpha = new Alpha();
// how can I access Alpha.defaults from myAlpha?
// myAlpha.constructor -> function Beta() {}
@desandro
desandro / transition-scroll-to.js
Created December 4, 2012 16:50
Use CSS transitions to scroll to element
( function( window, undefined ) {
'use strict';
// helper function
function capitalize( str ) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
// ========================= getStyleProperty by kangax ===============================
@desandro
desandro / add-event.js
Created November 15, 2012 03:04
add/remove event with handleEvent helper
// modified John Resig's http://ejohn.org/projects/flexible-javascript-events/
var div = document.createElement('div');
var addEvent, removeEvent;
if ( div.addEventListener ) {
addEvent = function( elem, type, fn ) {
elem.addEventListener( type, fn, false );
};
@desandro
desandro / index.html
Created November 7, 2012 03:30
Electoral college scaled maps
<blockquote class="twitter-tweet" data-in-reply-to="266011047348035585"><p>@<a href="https://twitter.com/desandro">desandro</a> We’ve got you covered. <a href="http://t.co/zd8l1svU" title="http://www.npr.org/blogs/itsallpolitics/2012/11/01/163632378/a-campaign-map-morphed-by-money">npr.org/blogs/itsallpo…</a></p>&mdash; Danny DeBelius (@dannydb) <a href="https://twitter.com/dannydb/status/266011471396364289" data-datetime="2012-11-07T02:57:31+00:00">November 7, 2012</a></blockquote>
<blockquote class="twitter-tweet" data-in-reply-to="266011047348035585"><p>@<a href="https://twitter.com/desandro">desandro</a> I’m sure there are prettier ones: <a href="http://t.co/UXvaKc40" title="http://election.princeton.edu/electoral-college-map/">election.princeton.edu/electoral-coll…</a></p>&mdash; Richard Archambault (@richardmtl) <a href="https://twitter.com/richardmtl/status/266011540073885696" data-datetime="2012-11-07T02:57:48+00:00">November 7, 2012</a></blockquote>
<blockquote class="twitter-tweet" data-in-reply-
@desandro
desandro / jquery.isotope.js
Created October 30, 2012 13:16
Isotope with deleting prevObject
/**
* Isotope v1.5.21
* An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co
*
* Commercial use requires one-time license fee
* http://metafizzy.co/#licenses
*
* Copyright 2012 David DeSandro / Metafizzy
*/
@desandro
desandro / jquery.isotope-csshooks.js
Created October 21, 2012 23:19
Isotope no cssHooks conflict
/**
* Isotope v1.5.20 - cssHooks no conflict
* An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co
*
* Commercial use requires one-time license fee
* http://metafizzy.co/#licenses
*
* Copyright 2012 David DeSandro / Metafizzy
*/
@desandro
desandro / close-pixelate.js
Created October 17, 2012 21:41
Close pixelate demo
/*!
* Close Pixelate v2.0.00 beta
* http://desandro.com/resources/close-pixelate/
*
* Developed by
* - David DeSandro http://desandro.com
* - John Schulz http://twitter.com/jfsiii
*
* Licensed under MIT license
*/
@desandro
desandro / masonry.js
Created October 7, 2012 15:23
vanilla masonry test
/**
* Vanilla Masonry v1.0.5
* Dynamic layouts for the flip-side of CSS Floats
* http://vanilla-masonry.desandro.com
*
* Licensed under the MIT license.
* Copyright 2012 David DeSandro
*/
/*jshint forin: false, undef: true, eqeqeq: true, curly: true, browser: true */
module.exports = function(grunt) {
grunt.registerTask( 'ls', function() {
grunt.utils.spawn({
cmd: 'ls'
}, function(err, result, code) {
grunt.log.writeln('done');
grunt.log.write( result );
});
});