Skip to content

Instantly share code, notes, and snippets.

View ghiden's full-sized avatar

Hidenari Nozaki ghiden

View GitHub Profile
function ruby_version() {
echo 'ruby('`rbenv version | sed -e 's/ .*//'`')'
}
function node_version() {
echo 'node('`nvm version`')'
}
PROMPT='%{$fg[yellow]%}$(ruby_version):$(node_version) %{$fg_bold[red]%}➜ %{$fg_bold[green]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}
$ '

bounded-zoom line chart example

Experimenting zoom behavior of d3. Zoom behavior is only active on x-axis.

A Pen by ghiden on CodePen.

License.

@ghiden
ghiden / D3-Grouping-Elements:-Part-2.markdown
Created September 18, 2013 09:17
A Pen by Hidenari Nozaki.

D3 Grouping Elements: Part 2

This time, sort function is cleaner than the previous one. It doesn't need to update rect and text position, just the container g. And, by using 'transform', appending rect and text becomes easier.

A Pen by Hidenari Nozaki on CodePen.

License.

@ghiden
ghiden / D3-Grouping-Elements.markdown
Created September 16, 2013 09:40
A Pen by Hidenari Nozaki.
HTML Font Size mapping
1: < 12px
2: < 15px
3: < 17px
4: < 21px
5: < 28px
6: < 40px
7: >= 40px
@ghiden
ghiden / gitconfig
Created February 18, 2013 02:13
git config
[user]
name = ...
email = YOUR@EMAIL.COM
[core]
autocrlf = input
safecrlf = true
[alias]
co = checkout
ci = commit
st = status
@ghiden
ghiden / scala_grouped_and_sliding
Created February 6, 2013 10:11
Scala grouped and sliding
scala> val a = (1 to 10).toList
a: List[Int] = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
scala> for (x <- a.grouped(2)) println(x)
List(1, 2)
List(3, 4)
List(5, 6)
List(7, 8)
List(9, 10)
@ghiden
ghiden / mine.zsh-theme
Last active October 10, 2015 08:48
oh-my-zsh prompt with rbenv version along with git stuff
function ruby_version() {
echo `rbenv version | sed -e 's/ .*//'`
}
PROMPT='%{$fg[yellow]%}$(ruby_version)%{$fg[yellow]%} %{$fg_bold[red]%}➜ %{$fg_bold[green]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}
$ '
ZSH_THEME_GIT_PROMPT_PREFIX="[%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}] %{$fg[yellow]%}✗%{$reset_color%}"
@ghiden
ghiden / bargraph.css
Last active January 13, 2017 00:33
D3.js bar graph example
.chart {
background: #b0e0f8;
margin: 5px;
}
.chart rect {
stroke: white;
fill: steelblue;
}
@ghiden
ghiden / open-starred-n-unstar-em.py
Created April 27, 2012 13:13
Open Google Reader's Starred items in browser
#!/usr/bin/env python
import sys
import gdata.service
import subprocess
import getpass
import urllib
import re
import os
import ConfigParser