Skip to content

Instantly share code, notes, and snippets.

@Aerlinger
Aerlinger / gist:6350064
Created August 27, 2013 05:55
Pretty print a hash in ruby
def pretty_hash(hash_obj)
hash_obj.inject("\n") { |collection, item| collection << " #{item[0]}: #{item[1]},\n" }
end
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
function loadrc(path::String)
if (path == ENV["HOME"] || path == "/")
return ""
end
loadrc(dirname(path))
juliarc = joinpath(path, ".juliarc.jl")
println(juliarc)
@Aerlinger
Aerlinger / fg_find_or_create.rb
Last active February 3, 2017 14:35
find_or_create with factory girl
module FactoryGirl
def self.find_or_create(resource_name, attributes = {}, &block)
clazz = resource_name.to_s.classify.constantize
model = clazz.find_by(attributes) || FactoryGirl.build(resource_name, attributes)
yield(model) if block_given? && model.new_record?
model.tap(&:save)
end
{
"metadata": {
"name": "",
"signature": "sha256:973f629a9825a5e2ab8a547b36f84aa20289633b121d810ca166ed9acdeebc6f"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@Aerlinger
Aerlinger / meeting_notes.md
Created July 16, 2015 20:17
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?
@Aerlinger
Aerlinger / Design Architecture
Created September 25, 2015 19:08
Technical Specification
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
Aerlinger / sprint.md
Last active October 19, 2015 18:25
Sprint Progress
require "active_support/all"
require "net/http"
token = "my_token"
url = "https://graph.facebook.com/v2.6/me/messages?"
sender = 100688998246663
text = "Hello"
request_params = {
recipient: {id: sender},
message: {text: text},
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.