Skip to content

Instantly share code, notes, and snippets.

💭
Working on private repos! :P

Damien Roche damien-roche

💭
Working on private repos! :P
Block or report user

Report or block damien-roche

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
@damien-roche
damien-roche / _google-analytics.slim
Last active Jun 12, 2019
Slim Template Google Analytics (2018)
View _google-analytics.slim
script{ async src="https://www.googletagmanager.com/gtag/js?id=YOURIDHERE" }
javascript:
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'YOURIDHERE');
View gist:de11565bc69cf932786b
# Working with Git
alias g='git'
alias gst='git status'
alias gc='git commit'
alias gca='git commit -a'
alias ga='git add'
alias gco='git checkout'
alias gb='git branch'
alias gm='git merge'
alias gd="git diff"
@damien-roche
damien-roche / rubymethodlookup.md
Last active Feb 23, 2020
A Primer on Ruby Method Lookup
View rubymethodlookup.md

A Primer on Ruby Method Lookup

Method lookup is a simple affair in most languages without multiple inheritance. You start from the receiver and move up the ancestors chain until you locate the method. Because Ruby allows you to mix in modules and extend singleton classes at runtime, this is an entirely different affair.

I will not build contrived code to exemplify the more complicated aspects of Ruby method lookup, as this will only serve to confuse the matter. If you are having trouble following method lookup in your own programs, it is not because Ruby has strange rules (it does), it is because your code is too tangled.

When you pass a message to an object, here is how Ruby finds what method to call:

1. Look within singleton class

You can’t perform that action at this time.