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
| def round_to(num, places) # Pass in both parameters | |
| (num * 10 ** places).round.to_f / 10 ** places | |
| end | |
| def ftoc(num) | |
| answerc = ((num - 32) / 1.8) | |
| puts "ftoc spits out #{self.class}" | |
| round_to(answerc, 1) | |
| end |
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
| describe "a thing" do | |
| 10.times do |i| | |
| it "#{i} is #{i}" do | |
| i.should eql i | |
| end | |
| end | |
| end |
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
| var x = function(userid) { | |
| return function(resp) { | |
| var user_name = JSON.parse(resp)["full_name"]; | |
| console.log(userid); | |
| build += "<li><a class='user' id='user-" + userid + "' href='#show-" + userid + "'>" + user_name + "</a></li>"; | |
| remaining -= 1; | |
| if (remaining == 0) { | |
| make_users_list(obj, build); | |
| hide_spinner(); | |
| $("#login").hide(); |
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
| describe ApplicationsService do | |
| # start using `double` | |
| let(:user) { double(:full_name => "bar") } | |
| let(:task) { double( | |
| :contractor => double, | |
| :client => double, | |
| :name => "foo" | |
| )} |
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
| $ drip kill | |
| $ time jruby -e 'puts 1' | |
| 1 | |
| real 0m1.272s | |
| user 0m2.090s | |
| sys 0m0.134s | |
| $ time jruby -e 'puts 1' |
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
| Failures: | |
| 1) Dir globs (Dir.glob and Dir.[]) finds the contents inside a jar with Dir.[] in a dir inside the jar | |
| Failure/Error: FileUtils.cp "glob-test.jar", 'glob_test/' | |
| Errno::ENOENT: | |
| No such file or directory - /Users/shep/Projects/jruby/glob-test.jar | |
| # org/jruby/RubyFile.java:810:in `stat' | |
| # ./lib/ruby/1.8/fileutils.rb:1207:in `lstat' | |
| # ./lib/ruby/1.8/fileutils.rb:1185:in `stat' | |
| # ./lib/ruby/1.8/fileutils.rb:1267:in `copy_file' |
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 Wrapper | |
| include Java::java.lang.Comparable | |
| attr_reader :a | |
| def initialize(a) | |
| @a = a | |
| end | |
| def compare_to(x) |
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
| module X | |
| def type(code, name) | |
| instance_eval do | |
| define_method "#{name}?" do |type| | |
| type == code | |
| end | |
| end | |
| end | |
| end |
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
| describe 'match_time' do | |
| (0..12).each do |h| | |
| (0..59).each do |m| | |
| it "should match #{h}:#{m} AM" do | |
| match_time("%02i:%02i AM" % [h, m]).should_not be_nil | |
| end | |
| end | |
| end | |
| end |
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 Foo | |
| end | |
| describe Foo do | |
| it 'Expecting one param, ignoring others' do | |
| subject.stub(:cool) | |
| subject.should_receive(:cool).with(1) | |
| subject.cool(1) | |
| subject.cool(2) |