Skip to content

Instantly share code, notes, and snippets.

$('input[type="date"]').each(function()
{
var picker = new Pikaday({ field: this });
$(this).data('pikaday', picker);
});
@dbushell
dbushell / gist:4247060
Created December 9, 2012 21:19
Add SVG upload support to a WordPress theme
// add to functions.php in your WordPress theme
add_filter('upload_mimes', 'my_upload_mimes');
function my_upload_mimes($mimes = array())
{
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
@dbushell
dbushell / gist:4131104
Created November 22, 2012 13:10
Animate scrolling to an element or offset
/*!
* requires jQuery
* usage:
* Scroller.to({ offset: 100 });
* Scroller.to({ target: $('#main') });
*
* advanced usage (with additional easing function not provided here)
* Scroller.to({ target: $('#main'), delay: 500, multiplier: 1.5, easing: 'easeOutQuad' });
*/
var Scroller = (function()
@dbushell
dbushell / dabblet.css
Created July 12, 2012 17:04
Diagonal Stripe Background with CSS and SVG
/**
* Diagonal Stripe Background with CSS and SVG
*/
body {
padding: 0;
margin: 0;
}
#content {
@dbushell
dbushell / gist:2773801
Created May 23, 2012 08:06
Touchscreen swipe events for image rotator
if (Modernizr.touch) {
var hero = $('#hero');
var touchCancel = function()
{
hero[0].removeEventListener('touchmove', touchMove, false);
hero[0].data('touch', false);
};
@dbushell
dbushell / gist:2567294
Created May 1, 2012 10:55
HTML Entities with jQuery and the Browser
var div = $('<div/>');
function encodeEntities(str) {
return div.text(str).html();
}
function decodeEntities(str) {
return div.html(str).text();
}