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 M | |
A = 1 | |
end | |
module M::N | |
B = 2 | |
end | |
class M::N::C | |
prepend M::N |
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
#!/usr/bin/ruby | |
require 'i2c' | |
bus = I2C.create('/dev/i2c-1') | |
bus.write(20, 200, "abcd") | |
bus.write(20, 201, "bcde") | |
while true | |
raise if "abcde" != bus.read(20, 5, 200) |
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
/^([147][0369]*[258]|([147][0369]*[147]|[258])([258][0369]*[147]|[0369])*([258][0369]*[258]|[147])|[0369])+$/ |
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
describe Random do | |
specify do | |
puts "Random seed was #{Random.srand}" | |
end | |
specify do | |
puts "Random seed was #{Random.srand}" | |
end | |
context "A" do |
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
# Old version | |
def f(a) | |
return a == 1 || | |
a == 2 || | |
a == 3 | |
end | |
# New version removing the a == 1 case | |
def f(a) | |
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
Timecop.freeze(DateTime.parse('2013-07-01 00:00 -0700')) { puts DateTime.now } | |
# -> 2013-06-30T23:00:00-08:00 |
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
describe "rspec" do | |
context "using .each" do | |
[1,2].each do |x| | |
let(:y) { x } | |
specify "#{x} == #{x}" do | |
y.should == x | |
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
#include <wixel.h> | |
#include <usb.h> | |
#include <usb_com.h> | |
#include <adc.h> | |
#include <stdio.h> | |
uint32 start_ms; | |
void resetTime() | |
{ |