Skip to content

Instantly share code, notes, and snippets.

@mbostock
mbostock / README.md
Last active June 7, 2023 18:33
Underscore’s Equivalents in D3

Collections

each(array)

Underscore example:

_.each([1, 2, 3], function(num) { alert(num); });
@the55
the55 / raphael.hotdog.js
Created March 24, 2012 14:28
hot dog raphael plugin
// hotdog from Andrew Cameron, from The Noun Project: http://thenounproject.com/noun/hot-dog/#icon-No1820
Raphael.fn.hotDog = function() {
this.setStart();
this.path("M85.889,59.75c1.061,3.918-0.738,8.412-4.068,9.746c-20.641,8.279-42.604,8.535-63.432,0.737 c-3.362-1.257-5.263-5.71-4.292-9.649l0,0c0.971-3.948,4.147-6.031,7.134-4.918c18.851,7.058,38.729,6.827,57.413-0.667 C81.602,53.816,84.824,55.827,85.889,59.75L85.889,59.75z");
this.path("M15.488,44.829c1.426,0.678,1.263,1.892,1.152,2.712c-0.116,0.863,1.747,1.009,2.305,0.786 c1.535-0.615,3.252-1.304,4.73-0.961c1.198,0.278,1.692,1.307,2.178,2.321c0.229,0.475,0.889,1.936,2.905,0.714 c1.323-0.802,2.878-1.567,4.36-1.38c1.347,0.168,2.033,1.251,2.875,2.178c1.421,1.562,2.584,0.732,3.102,0.366 c1.197-0.849,2.53-1.797,4.041-1.735c1.414,0.055,2.417,1.01,3.404,1.948c1.71,1.628,2.197,1.166,3.586-0.03 c1.08-0.929,2.177-1.873,3.634-1.932c1.535-0.063,2.91,0.854,4.143,1.676c2.047,1.366,2.512,0.902,3.619-0.39 c0.848-0.992,1.709-1.999,3.102-2.1
@the55
the55 / flickr: titles
Created February 11, 2012 19:02
Flickr: setting lots of titles and descriptions
//
// if you're using safari, or chrome use the console at (option+cmd+c)
// if you're using firefox, you'll need firebug's console
//
for (var i=0; i < $$('.photo_title input').length; i++) {
$$('.photo_title input')[i].value = 'TITLE';
};
@redsweater
redsweater / SwitchProfile
Created October 12, 2011 15:35
If you use ScanSnap, you can have GUI Scripting automate the process of switching among your scan profiles ...
-- Launches ScanSnap Manager, if necessary. Opens the ScanSnap Manager settings window,
-- changes to named profile, applies changes, and closes the window
-- Example:
SwitchToProfile("Standard")
on SaveActiveApplication()
return application
end SaveActiveApplication
on OpenOptionsWindow()
@matthewmccullough
matthewmccullough / gist:47267
Created January 15, 2009 05:15 — forked from halbtuerke/gist:31934
Show Git dirty status in your Unix bash prompt (symbols not compatible with CygWin)
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"