Skip to content

Instantly share code, notes, and snippets.

View fcastellanos's full-sized avatar

Fernando Castellanos fcastellanos

View GitHub Profile

Keybase proof

I hereby claim:

  • I am fcastellanos on github.
  • I am fcastellanos (https://keybase.io/fcastellanos) on keybase.
  • I have a public key whose fingerprint is 7747 EE37 6853 BCC2 7E64 BD9C FFE5 4CB0 EADD DF1B

To claim this, I am signing this object:

@fcastellanos
fcastellanos / phidgets_rfid.rb
Created January 15, 2013 02:26
Small Ruby app to show the PhidgetsRFID reader
require 'rubygems'
require 'phidgets-ffi'
puts "Library Version: #{Phidgets::FFI.library_version}"
rfid = Phidgets::RFID.new
puts "Wait for PhidgetRFID to attached..."
#The following method runs when the PhidgetRFID is attached to the system
@fcastellanos
fcastellanos / more_test_events.rb
Created August 12, 2011 00:47
DSL Example in Ruby
def monthly_sales
110 # TODO: read the real number from the database
end
setup do
puts "Setting up target sales"
@target_sales = 100
end
event "monthly sales are suspiciously high" do
@fcastellanos
fcastellanos / bind_unbind.rb
Created August 10, 2011 15:49
Bingind and Unbinding methods
class MyClass
def initialize(value)
@x = value
end
def my_method
@x
end
end
object = MyClass.new(1)
class Dinner
include Mongoid::Document
include Mongoid::Timestamps
field :title, :type => String
field :description, :type => String
field :hosted_by, type => String
field :contact_phone, type => String
field :address, type => String
(eval):10:in `before_update_callback_chain'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.7.4/lib/mongo_mapper/plugins/callbacks.rb:82:in `send'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.7.4/lib/mongo_mapper/plugins/callbacks.rb:82:in `run_callbacks'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.7.4/lib/mongo_mapper/plugins/callbacks.rb:88:in `run_callbacks'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.7.4/lib/mongo_mapper/plugins/associations/proxy.rb:91:in `call'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.7.4/lib/mongo_mapper/plugins/associations/proxy.rb:91:in `method_missing'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.7.4/lib/mongo_mapper/plugins/associations/proxy.rb:91:in `each'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.7.4/lib/mongo_mapper/plugins/associations/proxy.rb:91:in `send'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.7.4/lib/mongo_mapper/plugins/associations/proxy.rb:91:in `method_missing'
/Library/Ruby/Gems/1.8/gems/mongo_mapper-0.7.4/lib/mongo_mapper/plugins/callbacks.rb:87:in `run_callbacks'