Skip to content

Instantly share code, notes, and snippets.

View katdowns's full-sized avatar

Kat Downs Mulder katdowns

View GitHub Profile
@katdowns
katdowns / gist:8483997
Created January 18, 2014 00:01
raphael pattern
var s = r_obj.path(county.path);
s.attr({
stroke: '#999',
'stroke-width': '.3',
fill: 'url(http://www.washingtonpost.com/wp-srv/special/politics/primary-tracker/images/hash-bg-sm.png)',
'fill-opacity' : '.5',
'stroke-linejoin': 'round'
});
$(s.node).attr({
'name': county.name,
@katdowns
katdowns / gist:3746297
Created September 18, 2012 22:17
Resizing a raphael object
//for each path you draw
// var path should contain string with path coords
var c = paper.path(path);
//six params: 1 and 4 are scale, 5 is x, 6 is y,
//more details here: http://cancerbero.vacau.com/raphaeltut/#sec-types-transform
c.matrix.add(.4, 0, 0, .4, -200, -50);
//apply matrix
@katdowns
katdowns / age-from-birthday.php
Created July 3, 2012 04:34
Get age from birthday
$birthday = $year.'-'.$month.'-'.$day;
$age = date_diff(date_create($birthday), date_create('now'))->y;
@katdowns
katdowns / keypress-slideshow
Created July 2, 2012 20:36
Next/Back on Keypress
// left/right key press
$(document).keydown(function(e) {
if (e.which == 37) { // left key
$('#slideshow').cycle('prev');
} else if (e.which == 39) { // right key
$('#slideshow').cycle('next');
}
});