Skip to content

Instantly share code, notes, and snippets.

View yiskang's full-sized avatar

Eason Kang yiskang

View GitHub Profile
@caged
caged / d3-multi-line.js.coffee
Created December 30, 2011 17:23
d3.js line chart with multiple lines and points
$ ->
version = Number(document.location.hash.replace('#', ''))
data = [[3,7,9,1,4,6,8,2,5], [5,2,3,4,9,6,4,6,8]]
[pt, pl, pr, pb] = [20, 20, 20, 20] # padding
w = 800 - (pl + pr)
h = 300 - (pt + pb)
max = d3.max(data, (d) -> d3.max(d))
# Scales
x = d3.scale.linear().domain([0, data[0].length - 1]).range [0, w]
@ecarter
ecarter / mapOrder.js
Created December 2, 2011 15:40
Order an array of objects based on another array order
/**
* Sort array of objects based on another array
*/
function mapOrder (array, order, key) {
array.sort( function (a, b) {
var A = a[key], B = b[key];
@burnto
burnto / gist:943432
Created April 26, 2011 23:50
.bash_profile colors
export TERM=xterm-color
# set colors and prompt
#PS1="\[\e]2;\w\a\][\[\e[32m\]\u\[\e[0m\]@\[\e[31m\]\h\[\e[0m]\]:\[\e[35m\]\w\[\e[0m\]$ "
#PS2=">> "
#export PS1 PS2
export CLICOLOR="true"
export LSCOLORS="exfxcxdxbxegedabagacad"
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in