Skip to content

Instantly share code, notes, and snippets.

@robbin
robbin / file_read_by_line.go
Last active Sep 23, 2015
golang read file by lines
View file_read_by_line.go
package main
import (
"fmt"
"bufio"
"os"
"log"
)
func main() {
@robbin
robbin / proc and lamba
Created Oct 27, 2012
ruby proc and lamba difference
View proc and lamba
#!/usr/bin/env ruby
def foo
f = Proc.new { return "return from foo from inside proc" }
f.call # control leaves foo here
return "return from foo"
end
def bar
f = lambda { return "return from lambda" }
View ruby http code string
HTTP_STATUS_CODES = {
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
@robbin
robbin / .gitconfig
Created Aug 13, 2012
My git global config file
View .gitconfig
[user]
name = robbin
email = fankai@gmail.com
[color]
ui = true
[alias]
co = checkout
ci = commit
st = status
@robbin
robbin / .tm_properties
Created Aug 13, 2012
My textmate properties file
View .tm_properties
TMGIT = "/usr/local/bin/git"
PATH = "/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:$PATH"
fontName = "Monaco"
fontSize = 14
tabSize = 2
softTabs = Spaces
scmStatus = true
exclude = "{.{o,pyc},Icon\r,CVS,darcs,MTN,{arch},blib,~.nib}"