-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 587dd21
Showing
104 changed files
with
25,203 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# Some useful aliases | ||
# vi:filetype=sh: | ||
alias aliases='vim ~/.bash_aliases && source ~/.bash_aliases' | ||
|
||
# Function which adds an alias to the current shell and to | ||
# the ~/.bash_aliases file. | ||
add-alias () | ||
{ | ||
local name=$1 value="$2" | ||
echo "alias $name='$value'" >> ~/.bash_aliases | ||
eval "alias $name='$value'" | ||
alias $name | ||
} | ||
|
||
####### | ||
# git # | ||
####### | ||
alias gl='git pull' | ||
alias gp='git push' | ||
alias gd='git diff' | ||
alias gc='git commit -v' | ||
alias gca='git commit -v -a' | ||
alias gb='git branch -v' | ||
|
||
function gco { | ||
if [ -z "$1" ]; then | ||
git checkout master | ||
else | ||
git checkout $1 | ||
fi | ||
} | ||
|
||
function st { | ||
if [ -d ".svn" ]; then | ||
svn status | ||
else | ||
git status | ||
fi | ||
} | ||
|
||
####### | ||
# SVN # | ||
####### | ||
alias sup='svn up' # trust me 3 chars makes a different | ||
# alias sstu='svn st -u' # remote repository changes | ||
# alias scom='svn commit' # commit | ||
alias svnclear='find . -name .svn -print0 | xargs -0 rm -rf' # removes all .svn folders from directory recursively | ||
alias svnaddall='svn status | grep "^\?" | awk "{print \$2}" | xargs svn add' # adds all unadded files | ||
|
||
######## | ||
# RUBY # | ||
######## | ||
# use readline, completion and require rubygems by default for irb | ||
alias irb='irb --simple-prompt -r irb/completion -rubygems' | ||
|
||
# really awesome function, use: cdgem <gem name>, cd's into your gems directory | ||
# and opens gem that best matches the gem name provided | ||
function cdgem { | ||
cd /usr/lib/ruby/gems/1.8/gems/ | ||
cd `ls | grep $1 | sort | tail -1` | ||
} | ||
function gemdoc { | ||
firefox /usr/lib/ruby/gems/1.8/doc/`ls /usr/lib/ruby/gems/1.8/doc | grep $1 | sort | tail -1`/rdoc/index.html | ||
} | ||
|
||
alias qri='qri -w 106' | ||
alias fri='fri -w 106' | ||
|
||
######### | ||
# RAILS # | ||
######### | ||
alias ss='script/server' # start up the beast | ||
alias sr='kill -USR2 `cat tmp/pids/mongrel.pid`' # restart detached Mongrel | ||
alias sst='kill `cat tmp/pids/mongrel.pid`' # restart detached Mongrel | ||
alias sc='script/console' | ||
alias a='autotest -rails' # makes autotesting even quicker | ||
|
||
# see http://railstips.org/2007/5/31/even-edgier-than-edge-rails | ||
function edgie() { | ||
ruby ~/projects/rails/rails/railties/bin/rails $1 && cd $1 && ln -s ~/projects/rails/rails vendor/rails | ||
} | ||
|
||
######## | ||
# misc # | ||
######## | ||
|
||
alias texclean='rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky' | ||
alias clean='echo -n "Really clean this directory?"; | ||
read yorn; | ||
if test "$yorn" = "y"; then | ||
rm -f \#* *~ .*~ *.bak .*.bak *.tmp .*.tmp core a.out; | ||
echo "Cleaned."; | ||
else | ||
echo "Not cleaned."; | ||
fi' | ||
alias h='history' | ||
alias j="jobs -l" | ||
alias l="ls -lah" | ||
alias ll="ls -l" | ||
alias la='ls -A' | ||
# alias pu="pushd" | ||
# alias po="popd" | ||
|
||
# | ||
# Csh compatability: | ||
# | ||
alias unsetenv=unset | ||
function setenv () { | ||
export $1="$2" | ||
} | ||
|
||
######## |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ~/.bash_logout: executed by bash(1) when login shell exits. | ||
|
||
# when leaving the console clear the screen to increase privacy | ||
|
||
if [ "$SHLVL" = 1 ]; then | ||
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# ~/.bashrc: executed by bash(1) for non-login shells. | ||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | ||
# for examples | ||
|
||
# If not running interactively, don't do anything | ||
[ -z "$PS1" ] && return | ||
|
||
# don't put duplicate lines in the history. See bash(1) for more options | ||
export HISTCONTROL=ignoredups | ||
|
||
export EDITOR=vim | ||
|
||
# check the window size after each command and, if necessary, | ||
# update the values of LINES and COLUMNS. | ||
shopt -s checkwinsize | ||
|
||
# make less more friendly for non-text input files, see lesspipe(1) | ||
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)" | ||
|
||
# set variable identifying the chroot you work in (used in the prompt below) | ||
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then | ||
debian_chroot=$(cat /etc/debian_chroot) | ||
fi | ||
|
||
# Comment in the above and uncomment this below for a color prompt | ||
# PS1='\e[mwork:\e[0;31m\w\e[m \e[1;37m# ' | ||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\h\[\033[00m\]:\[\e[0;31m\]\w\[\e[m\]$(__git_ps1 " (%s)") $ ' | ||
# PS1=' $ ' | ||
|
||
# If this is an xterm set the title to user@host:dir | ||
case "$TERM" in | ||
xterm*|rxvt*) | ||
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' | ||
;; | ||
*) | ||
;; | ||
esac | ||
|
||
# Alias definitions. | ||
if [ -f ~/.bash_aliases ]; then | ||
. ~/.bash_aliases | ||
fi | ||
|
||
# enable color support of ls and also add handy aliases | ||
if [ "$TERM" != "dumb" ]; then | ||
eval "`dircolors -b`" | ||
alias ls='ls --color=auto' | ||
alias grep='grep --color=auto' | ||
#alias dir='ls --color=auto --format=vertical' | ||
#alias vdir='ls --color=auto --format=long' | ||
fi | ||
|
||
# enable programmable completion features (you don't need to enable | ||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile | ||
# sources /etc/bash.bashrc). | ||
if [ -f /etc/bash_completion ]; then | ||
. /etc/bash_completion | ||
fi | ||
|
||
# svk | ||
if [ -f ~/.svk/completion.sh ]; then | ||
. ~/.svk/completion.sh | ||
fi | ||
|
||
if [ -f ~/bin/sake-completion ]; then | ||
complete -C ~/bin/sake-completion -o default sake | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
:update_sources: true | ||
:verbose: true | ||
:bulk_threshold: 1000 | ||
:sources: | ||
- http://gems.rubyforge.org | ||
- http://gems.github.com | ||
:benchmark: false | ||
:backtrace: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[user] | ||
name = Mislav Marohnić | ||
email = mislav.marohnic@gmail.com | ||
[apply] | ||
whitespace = nowarn | ||
[alias] | ||
co = checkout | ||
[color] | ||
diff = auto | ||
status = auto | ||
branch = auto | ||
[core] | ||
excludesfile = /home/mislav/.gitignore | ||
editor = vim -c 'set ft=diff' | ||
[mirror] | ||
summary = true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.*.sw? | ||
.svn | ||
.DS_Store |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
set mainfont {Helvetica 10} | ||
set textfont {Courier 10} | ||
set uifont {Helvetica 10 bold} | ||
set tabstop 2 | ||
set findmergefiles 0 | ||
set maxgraphpct 50 | ||
set maxwidth 16 | ||
set cmitmode patch | ||
set wrapcomment none | ||
set showneartags 1 | ||
set showlocalchanges 1 | ||
set datetimeformat {%Y-%m-%d %H:%M:%S} | ||
set bgcolor white | ||
set fgcolor black | ||
set colors {green red blue magenta darkgrey brown orange} | ||
set diffcolors {red "#00a000" blue} | ||
set diffcontext 3 | ||
set selectbgcolor gray85 | ||
set geometry(main) 1197x812+23+55 | ||
set geometry(topwidth) 1193 | ||
set geometry(topheight) 285 | ||
set geometry(pwsash0) "719 2" | ||
set geometry(pwsash1) "959 2" | ||
set geometry(botwidth) 759 | ||
set geometry(botheight) 507 | ||
set permviews {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# from http://errtheblog.com/posts/89-huba-huba | ||
|
||
home = ENV['HOME'] | ||
|
||
Dir.chdir File.dirname(__FILE__) do | ||
dotfiles_dir = Dir.pwd.sub(home + '/', '') | ||
|
||
Dir['*'].each do |file| | ||
next if file == 'install.rb' | ||
target = File.join(home, ".#{file}") | ||
unless File.exist? target | ||
system %[ln -vsf #{File.join(dotfiles_dir, file)} #{target}] | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
#!/usr/bin/ruby | ||
require 'irb/completion' | ||
IRB.conf[:AUTO_INDENT] = true | ||
require 'pp' | ||
require 'rubygems' | ||
|
||
# students.map_by_first_name | ||
# require 'map_by_method' | ||
# 6.to_article | ||
#require 'to_activerecord' # warnings with Rails 2.0.2 | ||
# 'foo'.what?('FOO') | ||
require 'what_methods' | ||
# User.find(:all).map &its.contacts.map(&its.last_name.capitalize) | ||
require 'methodphitamine' | ||
|
||
load File.dirname(__FILE__) + '/.railsrc' if $0 == 'irb' && ENV['RAILS_ENV'] | ||
|
||
def time(times = 1) | ||
ret = nil | ||
Benchmark.bm { |x| x.report { times.times { ret = yield } } } | ||
ret | ||
end | ||
|
||
if defined? Benchmark | ||
class Benchmark::ReportProxy | ||
def initialize(bm, iterations) | ||
@bm = bm | ||
@iterations = iterations | ||
@queue = [] | ||
end | ||
|
||
def method_missing(method, *args, &block) | ||
args.unshift(method.to_s + ':') | ||
@bm.report(*args) do | ||
@iterations.times { block.call } | ||
end | ||
end | ||
end | ||
|
||
def compare(times = 1, label_width = 12) | ||
Benchmark.bm(label_width) do |x| | ||
yield Benchmark::ReportProxy.new(x, times) | ||
end | ||
end | ||
end | ||
|
||
# require 'wirble' | ||
# Wirble.init | ||
# Wirble.colorize | ||
|
||
require 'irb/completion' | ||
|
||
module Kernel | ||
private | ||
def r(arg) | ||
puts `fri "#{arg}"` | ||
end | ||
end | ||
|
||
class Object | ||
def puts_ri_documentation_for(obj, meth) | ||
case self | ||
when Module | ||
candidates = ancestors.map{|klass| "#{klass}::#{meth}"} | ||
candidates.concat(class << self; ancestors end.map{|k| "#{k}##{meth}"}) | ||
else | ||
candidates = self.class.ancestors.map{|klass| "#{klass}##{meth}"} | ||
end | ||
candidates.each do |candidate| | ||
#puts "TRYING #{candidate}" | ||
desc = `qri '#{candidate}'` | ||
unless desc.chomp == "nil" | ||
# uncomment to use ri (and some patience) | ||
#desc = `ri -T '#{candidate}' 2>/dev/null` | ||
#unless desc.empty? | ||
puts desc | ||
return true | ||
end | ||
end | ||
false | ||
end | ||
private :puts_ri_documentation_for | ||
|
||
def method_missing(meth, *args, &block) | ||
if md = /ri_(.*)/.match(meth.to_s) | ||
unless puts_ri_documentation_for(self,md[1]) | ||
"Ri doesn't know about ##{meth}" | ||
end | ||
else | ||
super | ||
end | ||
end | ||
|
||
def ri_(meth) | ||
unless puts_ri_documentation_for(self,meth.to_s) | ||
"Ri doesn't know about ##{meth}" | ||
end | ||
end | ||
end | ||
|
||
RICompletionProc = proc{|input| | ||
bind = IRB.conf[:MAIN_CONTEXT].workspace.binding | ||
case input | ||
when /(\s*(.*)\.ri_)(.*)/ | ||
pre = $1 | ||
receiver = $2 | ||
meth = $3 ? /\A#{Regexp.quote($3)}/ : /./ #} | ||
begin | ||
candidates = eval("#{receiver}.methods", bind).map do |m| | ||
case m | ||
when /[A-Za-z_]/; m | ||
else # needs escaping | ||
%{"#{m}"} | ||
end | ||
end | ||
candidates = candidates.grep(meth) | ||
candidates.map{|s| pre + s } | ||
rescue Exception | ||
candidates = [] | ||
end | ||
when /([A-Z]\w+)#(\w*)/ #} | ||
klass = $1 | ||
meth = $2 ? /\A#{Regexp.quote($2)}/ : /./ | ||
candidates = eval("#{klass}.instance_methods(false)", bind) | ||
candidates = candidates.grep(meth) | ||
candidates.map{|s| "'" + klass + '#' + s + "'"} | ||
else | ||
IRB::InputCompletor::CompletionProc.call(input) | ||
end | ||
} | ||
#Readline.basic_word_break_characters= " \t\n\"\\'`><=;|&{(" | ||
Readline.basic_word_break_characters= " \t\n\\><=;|&" | ||
Readline.completion_proc = RICompletionProc |
Oops, something went wrong.