Skip to content

Instantly share code, notes, and snippets.

View ewoodh2o's full-sized avatar

Elliott Wood ewoodh2o

  • CallRail
  • Atlanta, GA
View GitHub Profile
# Solves Stanford's SAAS anagram question
# http://spark-university.s3.amazonaws.com/berkeley-saas/homework/hw1.pdf
# Question 3
def combine_anagrams(words)
# Set up a hash to hold the groups:
# Keys will be the sorted anagram string
# Values will be the array of anagrams for that string
# Hash works well here because it's a fast lookup on
@ewoodh2o
ewoodh2o / a_description.md
Created October 3, 2012 19:50
Bash-Style Curly Brace Expansion

Bash-Style Curly Brace Expansion

Expands the curly-brace notation as supported by Bash.

expand "ab{c,d}e"
  => [ "abce", "abde" ]

expand "ab{c,d}e{1,2}"
 => [ "abce1", "abce2", "abde1", "abde2" ]
@ewoodh2o
ewoodh2o / README.md
Created October 11, 2012 16:45
Analytics Design Question

Loading Metrics from a Database

Given the following database schema:

| page_metrics                                         |
+------------------------------------------------------+
| id | page_id | date       | fans | comments | clicks |
+----+---------+------------+------+----------+--------+
| 11 |     123 | 2012-08-01 | 1750 |       23 |    103 |