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
use Rack::Logger | |
app = proc do |env| | |
[ 200, {'Content-Type' => 'text/plain'}, "a" ] | |
end | |
run app | |
#This will produce: | |
# Rack::Lint::LintError: rack.errors#close must not be called |
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' | |
d1 = [1,1,1,1,0,0,0,0,0] | |
d2 = [1,0,1,0,1,1,0,0,0] | |
d3 = [0,0,0,0,1,0,1,1,1] | |
def calc_sim vector1, vector2 |
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
Spec::Matchers.define :be_invalid_on do |field| | |
match do |model_instance| | |
!model_instance.valid? && model_instance.errors.on(field) != nil | |
end | |
end |
NewerOlder