Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pricees's full-sized avatar

Ted Price pricees

View GitHub Profile
@pricees
pricees / Splitting a Ruby on a Rail
Last active August 1, 2023 18:21
How I split a fat rails model
Background
Raise.com is built on top of Spree. We have in-lined spree, and have decorators
on the models to beat the band. We want to move away from Spree altogeher.
This involves taking the models from Spree, moving them to the Raise
base app. This merge has the potential to create lots of big classes. Big classes
are difficult to maintain. One of the first steps towards returning classes/models to
being "right sized." is splitting the business logic and the persistence.
What I did
@pricees
pricees / magic_formula_investing.md
Last active February 28, 2023 19:06
Magic Formula Investing

Cross-section between high earnings yields and high return on capital

The earnings yield tells us how good fast the company is generating value.
The return on capital tells us how good the company is at creating value (profits) using what its got in the coffers.

Formula

  1. Establish a minimum market capitalization (usually greater than $50 million).
  2. Exclude utility and financial stocks.
@pricees
pricees / Reliability vs. Downtime
Created February 24, 2011 19:57
Percentage of reliability (99% uptime) and the amount of downtime it relates to:
Nines of Reliability: (Hours / Minutes / Seconds)
2 9's (99%) = up to 87.6h / 5256.0m / 315360.0 seconds of downtime per year.
3 9's (99.9%) = up to 8.76h / 525.6m / 31536.0 seconds of downtime per year.
4 9's (99.99%) = up to 0.876h / 52.559999999999995m / 3153.6 seconds of downtime per year.
5 9's (99.999%) = up to 0.0876h / 5.256m / 315.36 seconds of downtime per year.
6 9's (99.9999%) = up to 0.00876h / 0.5256000000000001m / 31.536 seconds of downtime per year.
7 9's (99.99999%) = up to 8.76E-4h / 0.05256m / 3.1536 seconds of downtime per year.
@pricees
pricees / Ruby Database Url -> Config YAML
Last active March 9, 2021 12:09
Rails database connection, url to yaml
#########################################################
#
# This method takes a db connection url and returns rails
# config YAML
#
##########################################################
require "uri"
require "yaml"
@pricees
pricees / gist:6814856
Created October 3, 2013 18:41
MSN Money (10 year summary, 10 year key ratios)
13:37 $ cat parse.rb
require "nokogiri"
require "awesome_print"
def ten_year_key_ratios
# investing.money.msn.com/investments/key-ratios?symbol=aapl&page=TenYearSummary
doc = Nokogiri::HTML File.read("./10_yr_key_ratios")
data = []
doc.css("table.mnytbl tr").each do |n|
foo = n.search('th/span').map { |x| x.text.strip }
@pricees
pricees / end-to-end-process.md
Created November 12, 2014 22:29
The End-to-End Process

The End-to-End Process

Foundation for Producivity

Misc. Terminalogy

A stakeholder is anyone who can affect, or be affected, by the actions of a business, in part or as a whole. Examples: team manager, product manager, president.

Complexity is the sum of all of the work that is required to get the feature from concept to market (live, released). Fundamental building blocks of complexity include, but are not limited to, time and effort needed to complete a task.

@pricees
pricees / pryghtning-talk.md
Last active December 4, 2018 15:58
Pry-ghtning Talk

Dunder Mifflin => 2nd previous value

123
877
_ + __
=> 1000

HistoReplay

#Anatomy of a Git Diff

This is a hunk, not a chunk.

diff --git a/lorem b/lorem
index 5da0182..4fcdc38 100644
--- a/lorem
+++ b/lorem
@@ -16,4 +16,24 @@ Nullam congue nunc sollicitudin, fermentum urna vel, tempus lorem. Morbi molesti
@pricees
pricees / git-lt
Created September 25, 2018 16:54
#Anatomy of a Git Diff
This is a **hunk**, not a *chunk*.
```
diff --git a/lorem b/lorem
index 5da0182..4fcdc38 100644
--- a/lorem
+++ b/lorem
@@ -16,4 +16,24 @@ Nullam congue nunc sollicitudin, fermentum urna vel, tempus lorem. Morbi molesti

Keybase proof

I hereby claim:

  • I am pricees on github.
  • I am pricees (https://keybase.io/pricees) on keybase.
  • I have a public key ASAWbRPQvm0-rtCndpOV97jHD5YBztE_Ejd22wytR2JMxgo

To claim this, I am signing this object: