Skip to content

Instantly share code, notes, and snippets.

View pricees's full-sized avatar

Ted Price pricees

View GitHub Profile
@pricees
pricees / gist:4145263
Created November 25, 2012 20:43
Curses Part 2-3: Multiple windows
#!/usr/local/bin/ruby
require "curses"
begin
Curses.init_screen # bring it
line = nil
win = Curses::Window.new(5, 50, 10, 10)
wout = Curses::Window.new(5, 50, 20, 10)
@pricees
pricees / activemodel_callbacks.rb
Created January 9, 2018 20:18
Using ActiveModel::Callbacks
# ./Gemfile
# $ bundle
source "https://rubygems.org"
gem "activemodel"
###############################################
# foo.rb
# $ bundle exec ruby foo.rb
@pricees
pricees / active-living-and-discovery.txt
Last active January 3, 2018 15:10
Active living and discovery
Suggestions for discovering new stuff, active living, de-Google/Amazon/Facebook'ing my life
What to order at a restaurant?
- The signature item (if the restaurants signature item is crap...run)
- Chef’s or wait-staffs favorite
- The last thing the previous table ordered
- Ask for the freshest ingredients
How to choose a restaurant?
@pricees
pricees / centro-culture-questionnaire
Last active July 28, 2017 14:53
Centro Culture Questionnaire
Are you interested in cultivating a Centro engineering culture?
1) How does culture drive performance?
2) What is culture worth?
3) What processes in an organization affect culture?
What accomplishment(s) are you most proud of and why? (at Centro)
What accomplishment(s) are you most proud of and why? (outside Centro)
Of the teams you have worked on in your career:
- What has motivated you to give everything you have? Do you have that same motivation here? If not, what is lacking?
https://developer.mozilla.org/en-US/docs/Web/API/Console
# 2 ways to access
window.console.log("Hello World")
console.log("Yo, sup world!")
# Four different levels of output
console.log("Hello World") // console.debug is it's alias
@pricees
pricees / value_investing.rb
Last active June 4, 2017 13:08
Value Investing (CROIC)
# Margins of Safety
# 30% > $ 10B
# 50% - 30% for $1-10B Market Cap
# > 50% for < $1B
# Owner's Earnings
# Read more: http://www.oldschoolvalue.com/blog/valuation-methods/working-capital-free-cash-flow-fcf/#ixzz3O1Egljwo
# Owner earnings = Net income + depreciation & amortization +/- one-time items +/- changes in working capital - capital expenditures
def owner_earnings # Better than free cash flow
count = (ARGV.first || 3).to_i
puts "Creating #{count} threads"
threads = count.times.map do |n|
num = n + 1
puts "Creating thread #{num}"
t = Thread.new do
loop do
puts "Thread #{num}"
sleep rand(2..5)
end
@pricees
pricees / threads.rb
Last active April 25, 2017 05:51
Show Ruby Native Threads
t = Thread.new do
loop do
puts "Thread 1"
sleep rand(3)
end
end
t1 = Thread.new do
loop do
puts "\tThread 2"
echo "Hello World"
echo "Hello\nWorld"
echo "\nLoad another file into context"
. load_vars
echo "Loaded \$VAR from . load_vars and its value is: $VAR"
echo "Script is also environmentally conscious: \$HOME = ${HOME}"
@pricees
pricees / how-computer-works.txt
Created March 30, 2017 03:10
How a computer works...slide info
CPU
Control Unit
- Portillos Manager
- Tells input, output, memory and alu how to respond to instruction
- Here are those binary logic gates that we know and love
- When we say a computer is 1HZ it means it can execute a single instuction 1
time per second. A 2.4 Ghz machine is 2.4B instructions per unit. Times 4
cores!!
Algorithm/Logic Unit
- Algorithmic: add, substract, multiple, divide