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 'eventually' | |
class SentenceParser | |
include Eventually | |
def initialize(document) | |
@document = document | |
end | |
def parse! |
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
function cherry_compare() { | |
echo 'Out-of-date branch check' | |
echo '[master -> qa]' | |
git cherry -v qa master | |
echo '[qa -> stage]' | |
git cherry -v stage qa | |
echo '[stage -> stable]' |
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
# Synchronize all mainline branches (master, qa, stage, stable) | |
function reposync() { | |
git fetch | |
git checkout master | |
git rebase origin/master | |
git checkout qa | |
git rebase origin/qa | |
git checkout stage | |
git rebase origin/stage | |
git checkout stable |
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 STDOUT.puts *args | |
super(*args) | |
STDERR.puts(caller[0..5]) if args.any?{|a| a.to_s =~ /my semi-unique string/ } | |
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
# set some vars | |
@high = 100 | |
@low = 0 | |
# Simply calc the midpoint (no remainder) | |
# of the high and low value (bit shift right) | |
def ask | |
(@high + @low) >> 1 | |
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
>> hmm | |
hello | |
I got here | |
in ensure |
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 'date' | |
today = Date.today | |
peeps = [ | |
[:bj, 1983, 1, 18], | |
[:angelee, 1983, 12, 27], | |
[:bella, 2004, 11, 17], | |
[:anders, 2008, 6, 30], | |
[:india, 2012, 2, 23] |
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
# Fascinating behavior of symbolize_keys usage. If you have two keys that | |
# are `to_sym` equivalents, the non-symbol version is the winner, | |
# regardless of the order in the hash. | |
# For some reason I expected if a symbol key existed it would be | |
# the winner. | |
1.9.2p290 :002 > {"one" => 1, :one => 2}.symbolize_keys | |
=> {:one=>1} | |
1.9.2p290 :001 > {:one => 1, "one" => 2}.symbolize_keys | |
=> {:one=>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
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; | |
[animation setDuration:0.08]; | |
[animation setRepeatCount:3]; | |
[animation setAutoreverses:YES]; | |
[animation setFromValue:[NSValue valueWithCGPoint: | |
CGPointMake([formContainer center].x - 20.0f, [formContainer center].y)]]; | |
animation setToValue:[NSValue valueWithCGPoint: | |
CGPointMake([formContainer center].x + 20.0f, [formContainer center].y)]]; | |
[[formContainer layer] addAnimation:animation forKey:@"position"]; |
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
#!/usr/bin/env ruby | |
BRANCHES = %w( qa stage stable) | |
REJECT_OPTIONS = %w( git tag branch path ) | |
old_sha, new_sha, ref = STDIN.read.split(' ') | |
exit 0 unless BRANCHES.include?(ref.split('/').last) | |
diff = %x{ git diff-index --cached --name-only #{old_sha} 2> /dev/null } | |
#puts diff.inspect |