Skip to content

Instantly share code, notes, and snippets.

View elliot42's full-sized avatar

Elliot Block elliot42

  • Form Energy
  • Berkeley, CA
View GitHub Profile

Q. Why do CorporateDatabase and Store both have borrowRentable() and returnRentable()?

A. Store::borrowRentable() only deals with updating the store's own inventory.

CustomerDatabase::borrowRentable() deals with parsing streams, calling the store to update the store's inventory, as well as creating a new Transaction object and calling the Customer to update itself. You can see the differences below.

When CorporateDatabase is loading transactions, it will look something like this:

switch (first_char_we_found_on_the_stream) {

"Your standard database toolkit will tempt you to reach for a familiar abstraction layer: transactional isolation. If you can ensure that only one process can access the B-Tree at any time, then you don't have to worry about writes altering the data-structure while reads are in progress.

Homey don't play that: transactions are a form of locking, and I un-friended locking years ago, for posting too many lame updates to my log files."

title,category,creator,hits
save my dog,animals,joe,487,2012-08-01
save the geckos,animals,roberta,19744,2012-08-01
save my kidneys,health,joe,220,2012-08-01
save my lungs,health,angela,17763,2012-08-01
save the oceans,environment,matt,15385,2012-08-01
save the mountains,environment,joe,3458,2012-08-01
save my cat,animals,susan,25381,2012-08-02
save my dog,animals,joe,5594,2012-08-02
save the whales,animals,jim,31511,2012-08-02
elliot@t16:~$ xrandr -q
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192
LVDS1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 246mm x 185mm
1024x768 50.0*+ 60.0 40.0
800x600 60.3 56.2
640x480 60.0 59.9
VGA1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 519mm x 324mm
1920x1200 60.0 +
1600x1200 60.0
1680x1050 60.0

Three resolutions of information:

  1. Questions on specific projects (not well handled by morning sync)
  • Need more available free time during day to ask specific questions, detailed dives
  1. What projects are working on (well handled by morning sync)

  2. Vision for the project (not well handled by morning sync)

  • longer conversation
@elliot42
elliot42 / ordered_sets.rb
Created January 11, 2013 09:46
given a set S, and an ordered list of sets T0, T1, T2...Tn, return a map from each element E in S to the first set Tk where in Tk
irb(main):064:0> fools
=> [1, 2, 3, 4, 5]
irb(main):003:0> a = [:a, [2, 3]]
=> [:a, [2, 3]]
irb(main):004:0> b = [:b, [4, 5]]
=> [:b, [4, 5]]
irb(main):059:0> [a, b].reduce([fools, {}]) do |h, s|
The Four Metrics You Care About As A SaaS Business
The majority of small SaaS businesses can be entirely described by four
metrics: average plan value (over the customer base), new trials per
month, conversion rate of the trial, and churn (loss of paying accounts
over time).
McKenzie, Patrick (2012-12-02). Sell More Software: Website Conversion
Optimization for Software Developers (Kindle Locations 98-100). .
Kindle Edition.
@elliot42
elliot42 / gist:5121649
Last active December 14, 2015 17:19
remap CAPS -> CTRL
# $HOME/.xprofile
setxkbmap -option ctrl:nocaps
if [ -f $HOME/.Xmodmap ]; then
/usr/bin/xmodmap $HOME/.Xmodmap
fi
# $HOME/.Xmodmap
clear Lock
add Control = Caps_Lock
JS Include Structures
Multiple add_javascripts
- Clear code
- Bad for perf (multiple HTTP requests)
ONe big manifest
-
Our convention:
@elliot42
elliot42 / gist:5947837
Last active December 19, 2015 11:29
Baby's first Backbone
<html>
<head>
<script type="text/javascript" src="jquery-1.10.2.js"></script>
<script type="text/javascript" src="underscore.js"></script>
<script type="text/javascript" src="backbone.js"></script>
<script type="text/javascript">
$(function() {
var units = ["hour", "day", "month"];
var people = ["A", "B", "C", "D"];