This file contains hidden or 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 'benchmark' | |
strs = 1000.times.map{(0...32).map{(65 + rand(26)).chr}.join} | |
Benchmark.bm(6) do |x| | |
x.report('sum') { 100.times{strs.each &:sum} } | |
x.report('digest') { 100.times{strs.each{|s| Digest::MD5.hexdigest(s).to_i(16) }}} | |
end | |
# user system total real |
This file contains hidden or 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
create extension postgis; | |
create extension postgis_topology; | |
alter extension postgis update to "2.1.0"; |
This file contains hidden or 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
gem install ffaker | |
alias dizzle="ruby -e \"require 'ffaker'; puts Faker::DizzleIpsum.paragraph\" | tee >(pbcopy)" | |
alias hipster="ruby -e \"require 'ffaker'; puts Faker::HipsterIpsum.paragraph\" | tee >(pbcopy)" | |
### | |
$ dizzle | |
You talk too much like every single day Long Beach fo shizzle used to sell loot Coupe de Ville. | |
Real deal holyfield tha dizzle with my mind on my money fo shizzle. Real deal holyfield Mr. Buckwort |
This file contains hidden or 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
:plain | |
#{title} | |
look - this preserves the whitespace above | |
also note that title is unescaped because of :plain | |
\ | |
the "\" in the above line also adds a blank line | |
no blank line will be rendered above this one |
This file contains hidden or 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 'ffaker' | |
Faker::DizzleIpsum.sentence | |
=> "Every single one the diggy recognize it's 1993." | |
Faker::HipsterIpsum.sentence | |
=> "Irony sartorial fixie tofu." | |
Faker::LoremCN.sentence | |
=> "马到成功叮叮当当顷刻间数不胜数象牙白七窍生烟," |
This file contains hidden or 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
=> Booting WEBrick | |
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000 | |
=> Call with -d to detach | |
=> Ctrl-C to shutdown server | |
[2013-03-06 01:02:27] INFO WEBrick 1.3.1 | |
[2013-03-06 01:02:27] INFO ruby 2.0.0 (2013-02-24) [x86_64-darwin11.4.2] | |
--- 1 | |
/monkeys/index |
This file contains hidden or 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
brew update | |
brew install libyaml | |
rvm get head | |
rvm pkg install openssl | |
rvm install 2.0.0 --with-openssl-dir=$HOME/.rvm/usr --verify-downloads 1 | |
rvm use 2.0.0 --default | |
gem update rake | |
gem install bundler --pre |
This file contains hidden or 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 Array | |
# [1,2,3,4,5,6,7,8].in_groups_of_with_index(3, false) do |group, index| | |
# puts group.to_s + " " + index.to_s | |
# end | |
# [1, 2, 3] 0 | |
# [4, 5, 6] 1 | |
# [7, 8] 2 | |
# => [[1, 2, 3], [4, 5, 6], [7, 8]] | |
# | |
# [1,2,3,4,5,6,7,8].in_groups_of_with_index(3, "x") do |group, index| |
This file contains hidden or 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
rvm get head | |
rvm install 1.9.3-p374 --patch railsexpress | |
rvm use ruby-1.9.3-p374 --default |
This file contains hidden or 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
# gem install benchmark-ips | |
require 'rubygems' | |
require 'benchmark/ips' | |
module Mixin | |
def foo; 42; end | |
end | |
class SubclassArray < Array |