Skip to content

Instantly share code, notes, and snippets.

View flatten.rb
require "rspec"
def flatten(arr)
return [arr] unless arr.is_a? Array
arr.reduce([]) { |concat, item| concat + flatten(item) }
RSpec.describe "Flattening a nested array" do
it "is valid for simple array" do
View flatten.rb
require "rspec"
# Recursively flattens a nested array by performing a in-order depth first traversal and reducing the found items into a single, flat
# array within the tail call.
def flatten(arr)
return [arr] unless arr.is_a? Array
# Note that the return value of `reduce` is the last call in the our recursive `flatten` function, so nested items are concatenated
# in order as they return up the call stack.
View gist:d78b62fe91e16f9deec9e11f65717e5f
require "active_support/all"
require "net/http"
token = "my_token"
url = ""
sender = 100688998246663
text = "Hello"
request_params = {
recipient: {id: sender},
message: {text: text},
Aerlinger /
Last active Oct 19, 2015
Sprint Progress
Aerlinger / Design Architecture
Created Sep 25, 2015
Technical Specification
View Design Architecture
Design Architecture of Datamill
## Core Requirements
#####**High Level (user-facing) Design Requirements**
- **Multi-Tenancy:** Ability to service multiple users simultaneously
- **Low-Latency:** Where possible, data should always be current with less than a 15-20 minute delay.
- **Reliability:** Services should run with *> 99.99%* uptime. Data recovery should be possible in the event of service or hardware failure.
Aerlinger /
Created Jul 16, 2015
ODF Meeting 7/16/15
  1. Typical news/announcements
  2. Progress updates and what we've each been working on
  3. "Trimming the sails": Where we are, where we're going, and where we need to be
  4. Sprint Planning!
    • Towards a cohesive team-based workflow
    • Mixpanel
    • Automation
    • Infrastructure and Operations
  5. Core technology decisions
    • SBT/Maven?
View gist:d6610fdaef7ebdbb0003
"metadata": {
"name": "",
"signature": "sha256:973f629a9825a5e2ab8a547b36f84aa20289633b121d810ca166ed9acdeebc6f"
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
"cells": [
Aerlinger / fg_find_or_create.rb
Last active Feb 3, 2017
find_or_create with factory girl
View fg_find_or_create.rb
module FactoryGirl
def self.find_or_create(resource_name, attributes = {}, &block)
clazz = resource_name.to_s.classify.constantize
model = clazz.find_by(attributes) ||, attributes)
yield(model) if block_given? && model.new_record?
View gist:d46bffa9021d3cf08f13
function loadrc(path::String)
if (path == ENV["HOME"] || path == "/")
return ""
juliarc = joinpath(path, ".juliarc.jl")
View nesting_example.rb
module A
module B; end
module C
puts B
module D
# First looks for A::C::D::B (doesn't exist) then searches for A::B
puts "\nmodule A::C::D"
puts Module.nesting