Skip to content

Instantly share code, notes, and snippets.

Alvaro Muhlethaler amuhle

Block or report user

Report or block amuhle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am amuhle on github.
  • I am amuhlethaler (https://keybase.io/amuhlethaler) on keybase.
  • I have a public key ASA1n5UTyaOSodz--k1xNJ_DTDHjjcOUVH9NypPNEhBn_go

To claim this, I am signing this object:

@amuhle
amuhle / poodir-notes.md
Created Feb 13, 2019 — forked from speric/poodir-notes.md
Notes From "Practical Object-Oriented Design In Ruby" by Sandi Metz
View poodir-notes.md

Chapter 1 - Object Oriented Design

The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.

SOLID Design:

  • Single Responsibility Principle: a class should have only a single responsibility
  • Open-Closed Principle: Software entities should be open for extension, but closed for modification (inherit instead of modifying existing classes).
  • Liskov Substitution: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
  • Interface Segregation: Many client-specific interfaces are better than one general-purpose interface.
View my_flatten.rb
require 'minitest/autorun'
class ArrayUtil
attr_reader :array
def initialize(array)
@array = array
end
def super_flatten
@result = []
View gist:b13cfb78752f2c13304f
{
"id": 1880,
"first_name": "Jordi",
"last_name": "Alba",
"email": "jordialba@gmail.com",
"token": "BQ6A-Q353",
"status": {
"name": "results_ready",
"label": "Results Ready"
},
View select_all_bug
require 'active_record'
require 'mysql2'
require 'minitest/autorun'
require 'logger'
puts "ActiveRecord: #{ActiveRecord::VERSION::STRING}"
ActiveRecord::Base.establish_connection(adapter: "mysql2", host: "localhost", database: "test")
ActiveRecord::Base.logger = Logger.new(STDOUT)
class Author < ActiveRecord::Base
You can’t perform that action at this time.