Skip to content

Instantly share code, notes, and snippets.

Avatar

Greg Borenstein atduskgreg

View GitHub Profile
@atduskgreg
atduskgreg / Add getclicky.com logging to every link on a page using jquery
Created Aug 7, 2008
Add getclicky.com logging to every link on a page using jquery
View Add getclicky.com logging to every link on a page using jquery
View subclasses_of.rb
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
View moduler.rb
module One
def one
"one"
end
end
module Two
def two
"two"
end
View hardware_base.rb
module HardwareBase
def self.register_device_type mod, sym
@@device_registrations ||= {}
@@device_registrations[sym] = mod
end
end
module Servo
View hardware_base.rb
module HardwareBase
def self.register_device_type mod, sym
@@device_registrations ||= {}
@@device_registrations[sym] = mod
end
end
module Servo
View hardware_base.rb
module HardwareBase
def self.register_device_type mod, sym
@@device_registrations ||= {}
@@device_registrations[sym] = mod
end
end
module Servo
View class_accessor_hack.rb
class Myclass
class << self
attr_accessor :my_class_attribute
end
end
View gist:24204
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 Nov 12, 2008
RAD [Ruby Arduino] servo thermometer demo from RubyConf 2008
View gist:24207
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"
View gist:28719
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
You can’t perform that action at this time.