Skip to content

Instantly share code, notes, and snippets.

View bit-dragon's full-sized avatar
🏠
Working from home

Jorge García bit-dragon

🏠
Working from home
View GitHub Profile
@bit-dragon
bit-dragon / hooks.rb
Created January 16, 2013 15:36
An example of hook class/module
class ShippingOption
@children = []
def self.inherited(child)
@children << child
end
def self.for(weight, international)
@children.select do |child|
child.can_ship?(weight, international)
end
@bit-dragon
bit-dragon / mp1.rb
Last active December 11, 2015 04:58
Meta-programming examples
# Memoization
# Example number one
# Original class
#class Discounter
# def discount(*skus)
# expensive_discount_calculation(*skus)
# end
#
# private
@bit-dragon
bit-dragon / keybase.md
Created November 9, 2020 20:52
keybase

Keybase proof

I hereby claim:

  • I am bit-dragon on github.
  • I am bdragon (https://keybase.io/bdragon) on keybase.
  • I have a public key ASCW0NM7AnTzYqHAgTrC0cFncIk-_cFjsJr0GDfRe1rRSQo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am bit-dragon on github.
  • I am bdragon (https://keybase.io/bdragon) on keybase.
  • I have a public key ASCW0NM7AnTzYqHAgTrC0cFncIk-_cFjsJr0GDfRe1rRSQo

To claim this, I am signing this object: