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 'benchmark' | |
a = [] | |
iterations = 1_000_000 | |
puts "for empty array" | |
Benchmark.bm do |x| | |
x.report("length") { iterations.times do; a.length > 0; end } | |
x.report("any") { iterations.times do; a.any?; 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
class Foo | |
def hello | |
puts "hello" | |
end | |
end | |
Foo.new.hello | |
# What will return? |
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
name: Cardiothoracic Surgery score: 0.00022565003 | |
Explanation | |
description: sum of:, value: 0.00045130006, details: | |
description: max of:, value: 9.0260015e-05, details: | |
description: ConstantScore(name:cardio*), product of:, value: 9.0260015e-05, details: | |
description: boost, value: 1.0 | |
description: queryNorm, value: 9.0260015e-05 | |
description: ConstantScore(common_terms:cardio*), product of:, value: 9.0260015e-05, details: | |
description: boost, value: 1.0 | |
description: queryNorm, value: 9.0260015e-05 |
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
/Users/A664724/.rvm/gems/ruby-2.0.0-p451@global/gems/bundler-1.6.1/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777 | |
DEPRECATION WARNING: Model based mass assignment security has been extracted | |
out of Rails into a gem. Please use the new recommended protection model for | |
params or add `protected_attributes` to your Gemfile to use the old one. | |
To disable this message remove the `whitelist_attributes` option from your | |
`config/application.rb` file and any `mass_assignment_sanitizer` options | |
from your `config/environments/*.rb` files. | |
See http://guides.rubyonrails.org/security.html#mass-assignment for more information. |
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 User < ActiveRecord::Base | |
has_many :trips | |
has_many :feed_sources | |
has_many :photos | |
has_many :statuses | |
has_many :checkins | |
validates :name, :presence => true | |
def possessive_name |