Skip to content

Instantly share code, notes, and snippets.

@JoshCheek
JoshCheek / treehouse.rb
Created November 24, 2014 07:52
Fun times at Rubyconf!
class Treehouse
def initialize(ladder, happyduckslide, sadsharkslide)
@ladder = ladder # => #<StringIO:0x007fb29c0c8a68>
@happyduckslide = happyduckslide # => #<IO:<STDOUT>>
@sadsharkslide = sadsharkslide # => #<IO:<STDERR>>
end # => :initialize
def ride
name = @ladder.gets().chomp() # => "Josh", "Anna Marie"
if rand(2) == 1 # => true, false
@amejiarosario
amejiarosario / rails_activerecord_cheatsheet.md
Created June 18, 2012 22:18
Rails ActiveRecord (association) - Cheatsheet

Rails ActiveRecord (association) - Cheatsheet

http://guides.rubyonrails.org/association_basics.html

Types of associations

  • belongs_to : TABLE_NAME
  • has_one : TABLE_NAME [:through => :TABLE_NAME]
  • has_many : TABLE_NAME [:through => :TABLE_NAME]
  • has_and_belongs_to_many : TABLE_NAME [:join_table => :TABLE_NAME]
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.