Skip to content

Instantly share code, notes, and snippets.

@tal
Created June 16, 2011 19:57
Show Gist options
  • Select an option

  • Save tal/1030112 to your computer and use it in GitHub Desktop.

Select an option

Save tal/1030112 to your computer and use it in GitHub Desktop.
A few of my dotfiles.
[alias]
co = checkout
ci = commit
s = status -sb
revert-to = read-tree -u -m HEAD
sd = svn dcommit
sr = svn rebase
br = branch
df = diff
ff = rebase --stat @{upstream}
lg = log -p
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
ls = ls-files
pur = pull --rebase
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
heads = !"git log @{upstream}.. --format='%Cred%h%Creset;%C(yellow)%an%Creset;%H;%Cblue%f%Creset' | git name-rev --stdin --always --name-only | column -t -s';'"
wip = !"git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m \"wip\""
unwip = !"git log -n 1 | grep -q -c wip && git reset HEAD~1"
rb = !"git wip;git rebase -i @{upstream};git unwip"
pr = !"git fetch;git wip;git ff;git unwip;git heads"
pub = "!f() { git push -u ${1:-origin} `git symbolic-ref HEAD`; }; f"
[user]
name = Tal Atlas
email = [email protected]
[core]
editor = vim
excludesfile = ~/.gitignore
autocrlf = input
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
#!/usr/bin/ruby
require 'irb/completion'
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
IRB.conf[:PROMPT_MODE] = :SIMPLE
%w[rubygems looksee wirb].each do |g|
begin
require g
rescue LoadError
warn "Tried to load gem #{g} unsuccessfully from #{__FILE__}"
end
end
Wirb.start if defined?(Wirb)
class Object
# list methods which aren't in superclass
def local_methods(obj = self)
(obj.methods - obj.class.superclass.instance_methods).sort
end
# print documentation
#
# ri 'Array#pop'
# Array.ri
# Array.ri :pop
# arr.ri :pop
def ri(method = nil)
unless method && method =~ /^[A-Z]/ # if class isn't specified
klass = self.kind_of?(Class) ? name : self.class.name
method = [klass, method].compact.join('#')
end
system 'ri', method.to_s
end
end
def copy(str)
IO.popen('pbcopy', 'w') { |f| f << str.to_s }
end
def copy_history
history = Readline::HISTORY.entries
index = history.rindex("exit") || -1
content = history[(index+1)..-2].join("\n")
puts content
copy content
end
def paste
`pbpaste`
end
loc = File.expand_path('.irbrc')
load loc if File.exist?(loc) && loc != __FILE__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment