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
[user] | |
name = Brad Fults | |
email = bfults@gmail.com | |
[alias] | |
amend = commit --amend | |
co = checkout | |
st = status | |
cp = cherry-pick | |
# edit config (global, local) |
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 | |
> def bar; 1 end | |
> alias_method :baz, :bar | |
> end | |
=> Foo | |
>> class FooTwo < Foo | |
> def bar; 2 end | |
> end | |
=> nil |
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
ids = (1..1_000_000).to_a; nil | |
x = rand(1_000_000) | |
Benchmark.realtime do | |
10.times do | |
ids.to_set.include?(x) | |
end | |
end | |
# => 14.3837828636169 |
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 MyArray < Array; end | |
=> nil | |
>> a = MyArray.new([1,2,3]) | |
=> [1, 2, 3] | |
>> a.class | |
=> MyArray | |
>> a.reject {|x| x > 2}.class |
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
$ whois apple.com | |
Whois Server Version 2.0 | |
Domain names in the .com and .net domains can now be registered | |
with many different competing registrars. Go to http://www.internic.net | |
for detailed information. | |
APPLE.COM.WWW.BEYONDWHOIS.COM | |
APPLE.COM.WAS.PWNED.BY.M1CROSOFT.COM |
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
irb(main):033:0> stats = lambda { TokyoTyrantHandle.connection.current_connection.stat.split("\n").map {|i| vs=i.split("\t"); [vs[0] => vs[1]] }.flatten.inject({}) { |a,s| a.merge(s.keys.first => s.values.first) }.values_at('cnt_get', 'cnt_fwmkeys', 'cnt_put', 'cnt_out').map(&:to_i) }; res = 10.times.map { sleep 10; stats.call } | |
=> [[1414054383, 267722854, 668732970, 113985517], [1414055664, 267724365, 668733951, 113986564], [1414057054, 267725847, 668734993, 113987897], [1414058401, 267727235, 668735983, 113988827], [1414059735, 267728810, 668736976, 113989342], [1414061000, 267730358, 668737930, 113989818], [1414062189, 267731965, 668738915, 113990122], [1414063283, 267733524, 668739810, 113990639], [1414064276, 267734965, 668740685, 113990822], [1414065384, 267736397, 668741558, 113991083]] | |
irb(main):038:0> pp res.each_cons(2).map {|set_a, set_b| (0..3).map {|i| (set_b[i] - set_a[i]) / 10.0}}[[128.1, 151.1, 98.1, 104.7], [139.0, 148.2, 104.2, 133.3], | |
[134.7, 138.8, 99.0, 93.0], | |
[133.4, 157.5, 99.3, 51.5 |
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 bash | |
BUNDLER_BIN_PATH="" | |
# see BUNDLE_BIN is set in the current directories .bundle/config | |
if grep BUNDLE_BIN .bundle/config >/dev/null 2>/dev/null | |
then | |
BUNDLER_BIN_PATH=$(grep BUNDLE_BIN .bundle/config | cut -d ' ' -f 2 -) | |
# Expand the bundler stub path | |
eval BUNDLER_BIN_PATH=$BUNDLER_BIN_PATH |
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
[user] | |
name = Brad Fults | |
email = bfults@gmail.com | |
[alias] | |
amend = commit --amend | |
co = checkout | |
st = status | |
cp = cherry-pick | |
# edit config (global, local) |
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
$ rake db:load_config | |
** Invoke db:load_config (first_time) | |
** Execute db:load_config | |
rake aborted! | |
(<unknown>): did not find expected key while parsing a block mapping at line 1 column 1 | |
/Users/bfults/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:203:in `parse' | |
/Users/bfults/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:203:in `parse_stream' | |
/Users/bfults/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:151:in `parse' | |
/Users/bfults/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:127:in `load' | |
/Users/bfults/.rvm/gems/ruby-1.9.3-p194@uncommon/gems/railties-3.2.8/lib/rails/application/configuration.rb:115:in `database_configuration' |
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
var DATA = [ | |
'0', | |
'0000000000', | |
'0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' | |
]; | |
var chunkSize, i, printFactor; | |
var chunkIndex = (DATA.length - 1); | |
while (chunkIndex >= 0) { | |
try { | |
chunkSize = DATA[chunkIndex].length; |