This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer! | |
PS1='\[\033[01;32m\]\h \[\033[01;34m\]\W' #\$ \[\033[00m\]' | |
PS1=$PS1"\$(git branch 2>/dev/null | grep '^*' | colrm 1 2 | xargs -I {} echo ' (\[\033[01;31m\]'{}'\[\033[01;34m\])')" | |
export PS1=$PS1" \$ \[\033[00m\]" | |
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty! | |
# host ~/code/web (beta_directory) $ git checkout master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
center = [500,500] | |
radius = 500 | |
height = 100 | |
width = 100 | |
num_edge = 50 | |
num_hour = 10 | |
num_min = 10 | |
length_hour = 300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pp' | |
a=[1,[2,[3]],4,5,[6,7,[8,9]]] | |
pp a.inject([]){|b,x| if Array===x then x.each {|y| b << y } else b << x end;b;} |