Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 Float # because we are re-opening class float, anywhere we refer to self in | |
def pretty_s # this method will be the floating point number we call "pretty_s" on. | |
num = "%.12g" % self # num is a string representation of self with 12 decimal places | |
num.sub!(/\.(.*?)0+$/,".$1") # remove any trailing zeroes | |
# might be like 2. at this point # if we had all zeroes, there would be nothing after the decimal point | |
num = num[0..-2] if num[-1] == '.' # thus, let's remove the decimal point in that case | |
num # and return our string | |
end | |
end | |
p 1.1-0.9 # >> 0.20000000000000007 # floating point yuckiness means that we get this number instead of 0.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
module Test | |
def catcher | |
begin | |
pp Foo.bar | |
rescue Exception | |
pp "errored" | |
end | |
end | |
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
# can be found in features/support/env.rb | |
require 'pp' | |
require 'features/support/user' | |
require 'factory_girl_rails' |
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
Vagrant::Config.run do |config| | |
# Choose our base box: | |
config.vm.box = "centos" | |
# Talk to our central Chef server: | |
config.chef.run_list.clear | |
config.chef.chef_server_url = "https://chef.domain.com" | |
config.chef.validation_key_path = "validation.pem" | |
config.vm.provisioner = :chef_server | |
config.chef.add_role("vagrant-unstable") |
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 App < ActiveRecord::Base | |
end |