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
pexp(6, 1/5, lower.tail=FALSE) | |
# approximate exponential quantiles | |
qexp(.25, 1/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
fay-0.9.2.0 depends on uniplate-1.6.7 which failed to install. | |
language-ecmascript-0.10 depends on uniplate-1.6.7 which failed to install. | |
uniplate-1.6.7 failed during the building phase. The exception was: | |
ExitFailure 1 |
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 'shoes' | |
Shoes.app do | |
background "#DFA" | |
para "Welcome to Shoes" | |
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
saasbook@saasbook:~/projects/tasks/app$ bundle exec guard | |
Guard uses NotifySend to send notifications. | |
Guard is now watching at '/home/saasbook/projects/tasks/app' | |
Guard::RSpec is running, with RSpec 2! | |
Running all specs | |
/home/saasbook/projects/tasks/minitest/ruby/1.9.1/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load': no such file to load -- /home/saasbook/projects/tasks/app/spec (LoadError) | |
from /home/saasbook/projects/tasks/minitest/ruby/1.9.1/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `block in load_spec_files' | |
from /home/saasbook/projects/tasks/minitest/ruby/1.9.1/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `map' | |
from /home/saasbook/projects/tasks/minitest/ruby/1.9.1/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load_spec_files' | |
from /home/saasbook/projects/tasks/minitest/ruby/1.9.1/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:22:in `run' |
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 | |
files = Dir.glob("*.pdf") | |
files.each do |f| | |
# puts f.sub(/.pdf/, '') | |
IO.popen("convert -scale 2000x1000 #{f} #{f}.jpg") | |
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
# return every n'th element in an enumerable | |
def every_nth(count) | |
index = 0 | |
self.each do |elt| | |
yield elt if index % count == 0 | |
index += 1 | |
end | |
end | |
list = (1..10).to_a # make an array from a range |
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
at_exit do | |
if $! | |
open('crash.log', 'a') do |log| | |
error = { | |
:timestamp => Time.now | |
:message => $!.message, | |
:backtrace => $!.backtrace, | |
:gems => Gem.loaded_specs,inject({}){ | |
|m, (n,s)| m.merge(n => s.version) | |
} |
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
tries = 0 | |
begin | |
tries += 1 | |
puts "Trying #{tries}..." | |
raise "Didn't work" | |
rescue | |
retry if tries < 3 | |
puts "I give up" | |
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
require 'open-uri' | |
open( "http://preeventualist.org/lost" ) do |lost| | |
puts lost.read | |
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
st> Transcript show: 'hello world!' | |
hello world!Transcript |