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 'argus' | |
| # Video at: http://youtu.be/6V7hTH35xWw | |
| drone = Argus::Drone.new | |
| drone.start | |
| drone.take_off | |
| sleep 5 | |
| 2.times do | |
| drone.left(0.3) |
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 Dog | |
| def wag(tail=my_tail) | |
| tail | |
| end | |
| def my_tail | |
| :dogs_tail | |
| end | |
| end | |
| class Cat |
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
| # See a video of this at: http://www.youtube.com/watch?v=jlKt2Ed-Y04&feature=youtu.be | |
| require 'ardrone' | |
| drone = ARDrone::Drone.new | |
| drone.start | |
| drone.take_off | |
| sleep 5 | |
| drone.turn_right(1.0) |
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
| $ rvm install rbx --1.9 | |
| rbx-head installing #dependencies | |
| Cleaning git repo | |
| Fetching from origin | |
| Pulling from origin master | |
| Copying from repo to source... | |
| rbx-head - #configuring | |
| rbx-head - #compiling | |
| Error running 'env CONFIGURE_ARGS=--with-libyaml-dir=/Users/jim/.rvm/usr /Users/jim/.rvm/wrappers/ruby-1.8.6-p420/rake install --trace', please read /Users/jim/.rvm/log/rbx-head/rake.log | |
| There has been an error while running 'CONFIGURE_ARGS=--with-libyaml-dir=/Users/jim/.rvm/usr /Users/jim/.rvm/wrappers/ruby-1.8.6-p420/rake install --trace'. |
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
| # See video at: http://www.youtube.com/watch?v=3NlYGn3QY4U&feature=youtu.be | |
| require 'socket' | |
| class ATCommand | |
| def initialize(socket, host=nil) | |
| @host = host || '192.168.1.1' | |
| @socket = socket | |
| @tick = 0 | |
| @buffer = "" |
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
| #!/usr/bin/env ruby | |
| require 'open-uri' | |
| require 'json' | |
| # Note: Some of these haven't filled out the who's who page yet | |
| MISSING = %w(codingbull ericries flngn giffco JeetKunDoug Joi kattrali kEND rabble tappythebird) | |
| updating = ARGV.include?("--update") |
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 'flexmock/dual' | |
| RSpec.configure do |config| | |
| config.mock_with FlexMock.flexmock_and(:rspec) | |
| end | |
| describe "Dual Mocking" do | |
| before do | |
| @rm = mock("with rspec") | |
| @rm.should_receive(: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
| $ ruby -v | |
| ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.2.0] | |
| $ irb | |
| >> RUBY_VERSION | |
| => "1.8.7" | |
| >> p = lambda { |*args, &block| puts [args, block].inspect } | |
| => #<Proc:0x000000010b97b678@(irb):2> | |
| >> p.call(1,2,3) { :hi } | |
| [[1, 2, 3], #<Proc:0x000000010b94bef0@(irb):3>] |
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 Stack do | |
| # Suggested Syntax... | |
| Invariants do | |
| If { stack.empty? } | |
| Then { stack.depth.should == 0 } | |
| Then { stack.should be_pushable } | |
| ElseIf { stack.full? } | |
| Then { stack.depth.should == stack.max_depth } | |
| Then { stack.should_not be_pushable } |
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
| # Experimental And Clauses | |
| # | |
| # I've been thinking about tests where there are multiple Thens | |
| # in a single context. All the Givens and before blocks are run | |
| # for each Then. Since Then's are idempotent, that seems to be a waste. | |
| # | |
| # Maybe we can introduce And clauses. They are like Then clauses, but | |
| # they reuse the Givens of an existing Then clause. This could make a | |
| # difference in spec that have expensive setups. | |
| # |