Skip to content

Instantly share code, notes, and snippets.


Diego E. Salazar DiegoSalazar

View GitHub Profile
DiegoSalazar / fibber.rb
Created Jul 2, 2016
Memoized Fibonacci in Ruby
View fibber.rb
# memoized fibonacci in Ruby
class Fibber
attr_accessor :hash
def initialize
@hash = {}
def memo_fib(n)
for number in 0..n
if number < 2
@hash[number] = number
View gist:fb0aa1163a6a2fe4a6d1

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

View example output
attachments: parent_id, asset_id
domain_names: organisation_id
event_memberships: user_id, event_id
events: editor_id
group_actions: user_id, group_id
groups: user_id
icons: parent_id
invitations: sender_id
legacy_actions: item_upon_id
news_items: author_id