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
# m h dom mon dow command | |
41 9 19 12 * cd /home/ajfaraday/NetworkEnsemble/ && ruby script/play.rb sequences/christmas/flashmob.csv | |
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 Santa < Elf | |
ATTRIBUTES = ['Jolly','Old'] | |
has_many :children | |
def christmas | |
list = children.where(:behaviour => 'nice') | |
2.times do | |
list.reject!{|x| x.naughty? } |
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
Line 3: | |
9: comma | |
18: comma | |
29: comma | |
Line 4: | |
10: comma | |
31: comma | |
Line 7: | |
2: letter i missing a dot | |
9: open square brackets ( [ ) |
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
TOLERANCE = 50 | |
def near_top_wall? | |
sensors.position.y >= (arena.height - TOLERANCE) | |
end | |
def near_bottom_wall? | |
sensors.position.y <= TOLERANCE | |
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
module ActiveRecord | |
class Migration | |
def self.rename_table_if_needed(old_name, new_name) | |
rename_table(old_name, new_name) | |
rescue => ex | |
puts "rename_table(#{old_name},#{new_name}) failed #{ex.message}" | |
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
<!-- Some form or other --> | |
<script type='application/javascript'> | |
// Expected indentation | |
<% if @validate %> | |
run_validation(); | |
<% end %> | |
// rubymine standard indentation |
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
ajfaraday@ajf-samsung:~/work/sonic-pi-v2.6.0/app/server/bin$ ./compile-extensions.rb | |
Clearing ./../rb-native/linux/2.2.1p85 | |
Creating ./../rb-native/linux/2.2.1p85 | |
Compiling native extension in /home/ajfaraday/work/sonic-pi-v2.6.0/app/server/vendor/rugged/ext/rugged | |
./compile-extensions.rb:63:in `chdir': No such file or directory @ dir_chdir - /home/ajfaraday/work/sonic-pi-v2.6.0/app/server/vendor/rugged/ext/rugged (Errno::ENOENT) | |
from ./compile-extensions.rb:63:in `block in <main>' | |
from ./compile-extensions.rb:56:in `each' | |
from ./compile-extensions.rb:56:in `<main>' |
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
ajfaraday@wreck-it:~/work/zoo$ ruby script/01_eat.rb | |
Found Cow named Bessie | |
Bessie is munching some grass | |
Found Dog named Shep | |
/home/ajfaraday/work/zoo/lib/animal.rb:14:in `eat': Bad Dog! You are not allowed to eat Bessie (RuntimeError) | |
from script/01_eat.rb:7:in `<main>' |
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 'libusb' | |
usb_context = LIBUSB::Context.new | |
device = usb_context.devices( | |
idVendor: 0x054c, idProduct: 0x0002 | |
).first | |
handle = device.open | |
x = handle.control_transfer( | |
:bmRequestType => 0x21, |
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 'rubygems' | |
require 'twitter' | |
search = Twitter::Search.new | |
i = 0 | |
search.containing("marry me").to("justinbieber").each do |r| | |
puts "#{r.from_user}: #{r.text}" | |
i += 1 | |
end | |
puts i |