Sharing some random tidbits I learned throughout the week.
Back from the Shopify Intern Retreat!
- When adding a decimal column in Rails, you can specify a
precisionand ascale.precisionis the number of significant digits.scaleis the number of digits stored following the decimal point.- ie. 123.45 has a precision of 5 and a scale of 2.
Hash#deletedeletes a key-value pair and returns the value from a hash
h = { "a" => 100, "b" => 200 }
h.delete("a") #=> 100- Ruby keyword arguments can be used to know what arguments mean without looking at the method implementation.
- Can also switch up the order of the arguments without changing behaviour of the method which would occur with positional arguments.
def score(num_correct:, num_blank:, num_incorrect)
num_correct * 3 + num_blank - num_incorrect * 2
end
score(num_blank: 2, num_incorrect: 1, num_correct: 4) #=> 12- Toxiproxy is used to simulate network conditions.
- Prove that your application is resiliant to single points of failiure.
- ejson is a command line utility to manage secrets.
- Secrets can be encrypted and stored safetly in a git repo.
- Decryption can be restricted to production environments.
- Remapping
Caps LocktoCtrlis an amazing trick to save you from reaching for that awkward pinky position. - In YAML, you can define an object and re-use it with modifications later.
box: &green_box
size: Medium
colour: Green
large_box:
<<: *green_box
size: Large- tmux is a neat terminal multiplexer that lets you manage your sessions and terminal windows.
- Can manage configuration with a
.tmux.conffile.
- Can manage configuration with a
- The management expense ratio is the percentage of a mutual fund’s assets that goes towards fees that run the fund each year.
- Generally, the lower the ratio, the better.
- Portfolio Managers get paid in 2 ways:
- Expense Ratio
- Two and Twenty
- 2% of total asset value as management fee.
- 20% of profits earned.
- The Sharpe Ratio is used to measure an asset performance.
- It determines how well of a return an asset has compared to the risk that the investor took.
- The higher the Sharpe ratio, the better.
- Assets with the same return but different Sharpe ratio means that one stock is more volatile or “risky” than the other.
- Weekly vim
CTRL-aincrements number under cursor.CTRL-xdecrements it.- Can record macro using
q+{char}and then execute it using@{char}. ~inverts the case of a selection.- Can fold, open and close folds using
zf,zo,zc.