Example reference-style link across newlines.
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
def join(*args) | |
args.unshift self | |
result = args.pop | |
result = Pathname.new(result) unless Pathname === result | |
return result if result.absolute? | |
args.reverse_each {|arg| | |
arg = Pathname.new(arg) unless Pathname === arg | |
result = arg + result | |
return result if result.absolute? | |
} |
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
class Foo | |
autoload :Bar, 'foo/bar' | |
autoload :Baz, 'foo/baz' | |
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
Stage this hunk [y,n,q,a,d,/,k,K,g,e,?]? @@ -48 +81,2 @@ | |
end | |
\ No newline at end of file | |
Stage this hunk [y,n,q,a,d,/,k,K,g,e,?]? @@ -48 +81,2 @@ | |
end | |
\ No newline at end of file | |
Stage this hunk [y,n,q,a,d,/,k,K,g,e,?]? @@ -48 +81,2 @@ | |
end | |
\ No newline at end of file | |
Stage this hunk [y,n,q,a,d,/,k,K,g,e,?]? @@ -48 +81,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
git branch -r | while read BRANCH; do | |
if [ `git incoming $BRANCH | wc -l` == 0 ]; then | |
echo $BRANCH | |
fi | |
done |
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
git branch -r | while read BRANCH; do | |
if [ `git incoming $BRANCH | wc -l` != 0 ]; then | |
AUTHOR=`git log $BRANCH -n 1 --format=format:%ae` | |
MESSAGE="You appear to be the person responsible for \`$BRANCH\`. It has unmerged commits. Can you take a second take make sure you still need it? If so, merge it when you can. If not, do a \`git push origin :${BRANCH#origin/}\`. Thanks." | |
echo -e $MESSAGE | mail -s "Possible stale branch" $AUTHOR | |
fi | |
done |
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
# which is the correct return value? | |
{ :a => 1, :b => 2 }.fetch(:a, :b) # => [ 1, 2 ] | |
{ :a => 1, :b => 2 }.fetch(:a, :b) # => :b |
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
[alias] | |
current-branch = "!f() { B=$(git symbolic-ref HEAD) && echo ${B#refs/heads/}; }; f" | |
current-remote = "!f() { B=$(git config branch.$(git current-branch).remote) && echo ${B}; }; f" | |
current-merge = "!f() { B=$(git config branch.$(git current-branch).merge) && echo ${B#refs/heads/}; }; f" | |
current-track = "!f() { R=$(git current-remote) && M=$(git current-merge) && echo ${R}/${M}; }; f" | |
remove = "!f() { git ls-files --deleted -z $@ | xargs -0 git rm -r; }; f" | |
addremove = "!f() { git add -v ${@-.}; git remove $@; }; f" | |
incoming = "!f() { T=$( [ \"${1}\" == \"\" ] && echo $(git current-track) || echo ${1} ) && git log ..${T}; }; f" | |
outgoing = "!f() { T=$( [ \"${1}\" == \"\" ] && echo $(git current-track) || echo ${1} ) && git log ${T}..; }; f" | |
wip = "!f() { git addremove $@; git commit -m 'Work in progress'; }; f" |
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
def reload_browser(paths = []) | |
UI.info "Reloading browser: #{paths.join(' ')}" | |
paths.each do |path| | |
path = path.gsub %r{ (\.[^.]+) .* }x, '\1' | |
data = ['refresh', { | |
:path => "#{Dir.pwd}/#{path}", | |
:apply_js_live => @options[:apply_js_live], | |
:apply_css_live => @options[:apply_css_live] | |
}].to_json |
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
#!/bin/bash | |
# include profile location variables | |
. ~/.profile | |
. ~/.profile.git/profile-env | |
# update ourself | |
(cd $DOT_PROFILE && git pull) | |
# symlink all home.d files into place |