Skip to content

Instantly share code, notes, and snippets.

View atduskgreg's full-sized avatar

Greg Borenstein atduskgreg

View GitHub Profile
@atduskgreg
atduskgreg / Add getclicky.com logging to every link on a page using jquery
Created August 7, 2008 23:28
Add getclicky.com logging to every link on a page using jquery
def subclasses_of klass
result = []
ObjectSpace.each_object(Class) do |o|
result << o if o.ancestors.include? klass
end
result.reject{|i| i == klass}
end
module One
def one
"one"
end
end
module Two
def two
"two"
end
module HardwareBase
def self.register_device_type mod, sym
@@device_registrations ||= {}
@@device_registrations[sym] = mod
end
end
module Servo
module HardwareBase
def self.register_device_type mod, sym
@@device_registrations ||= {}
@@device_registrations[sym] = mod
end
end
module Servo
module HardwareBase
def self.register_device_type mod, sym
@@device_registrations ||= {}
@@device_registrations[sym] = mod
end
end
module Servo
class Myclass
class << self
attr_accessor :my_class_attribute
end
end
class ServoDrum < ArduinoSketch
output_pin 11, :as => :right, :device => :servo
output_pin 7, :as => :left, :device => :servo
serial_begin
@val = int
def loop
digitalWrite 13, ON
@atduskgreg
atduskgreg / gist:24207
Created November 12, 2008 16:59
RAD [Ruby Arduino] servo thermometer demo from RubyConf 2008
class ServoDemo < ArduinoSketch
external_vars :sensor_position => "int, 0", :servo_amount => "int, 0"
output_pin 15, :as => :myTemp, :device => :onewire
output_pin 14, :as => :my_servo, :device => :servo
serial_begin
@hi_byte = "0, int"
@lo_byte = "0, int"
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}