Skip to content

Instantly share code, notes, and snippets.

View DiegoSalazar's full-sized avatar

Diego E. Salazar DiegoSalazar

View GitHub Profile
DiegoSalazar / fibber.rb
Created July 2, 2016 01:49
Memoized Fibonacci in Ruby
# 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

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

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