Skip to content

Instantly share code, notes, and snippets.

@ches
ches / resources.md
Last active August 29, 2015 14:03
BKK Web Meetup - Big Data Open Panel, July 8th 2014 - Resources

Following are some resources referred to during the discussion, afterward in one-on-one chats, plus a few that I thought might be of interest for futher reading. As the panel turned out to be, these are mostly technical, with a few of interest to analyst types. I too wish that we had a bit more coverage of business case studies.

[Big Data: Principles and best practices of scalable realtime data systems][marz]

Nathan Marz and James Warren (Manning Publications)

A wealth of insight on building an architecture employing multiple data stores in order to serve differing latency requirements, and hedge risks and weaknesses. Marz initially developed Apache Storm for Backtype, acquired by Twitter. Still in "Early Access Edition" status, but all chapters are now available. If you're not technical but you'd like an introduction to the technical considerations, [Marz's post that led to the book][marz cap] is a briefer overview.

[Questioning the Lambda Architecture][kreps lambda]

#!/usr/bin/env ruby
require 'netrc'
require 'octokit'
org_name = ARGV[0]
unless org_name
abort "Usage #{$0} org_name"
end
@ches
ches / snippet.js
Last active December 20, 2015 21:08
analytics.js load routine annotated
// Create a queue, but don't obliterate an existing one!
var analytics = analytics || [];
(function () {
// A list of all the methods we want to generate queueing stubs for.
var methods = [
'identify', 'track', 'trackLink', 'trackForm', 'trackClick', 'trackSubmit',
'page', 'pageview', 'ab', 'alias', 'ready', 'group'
];
@ches
ches / ansible.rb
Created August 2, 2013 02:24
Ansible Homebrew formula. Might not be accepted, so alas, Gist. See https://github.com/mxcl/homebrew/pull/21602
require 'formula'
class Ansible < Formula
homepage 'http://www.ansibleworks.com/'
url 'http://ansibleworks.com/releases/ansible-1.2.2.tar.gz'
sha1 '41672bf49ccdfcfe09a3614171a80e979304e071'
head 'https://github.com/ansible/ansible.git', :branch => 'devel'
depends_on :python => ['paramiko', 'jinja2']
@ches
ches / follow_observer_spec.rb
Last active November 29, 2018 01:34
Example of testing Rails observers in isolation for cross-cutting concerns
require 'spec_helper'
# Bustle is a pubsub system used for activity streams:
# https://github.com/fredwu/bustle
#
# Here when a person follows another (or a discussion, for instance), the observer wires
# up pubsub between them for future activity notifications. The Follow model knows nothing
# about the implementation choices for the pubsub system.
describe FollowObserver do
subject { FollowObserver.instance }
@ches
ches / gist:4770693
Created February 12, 2013 15:34
Date#step, a C method, does not like ActiveSupport::Duration
[2] pry(main)> Date.today.step(Date.tomorrow, 30.minutes).each { |time| puts time }
2013-02-12
TypeError: expected numeric
from (pry):2:in `step'
[3] pry(main)> show-source 30.minutes
From: /Users/ches/.rvm/gems/ruby-1.9.3-p327@REDACTED/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric/time.rb @ line 39:
Owner: Numeric
Visibility: public
Number of lines: 3
@ches
ches / config-initializers-elasticsearch.rb
Created July 11, 2012 11:51
Some Tire setup tips for ElasticSearch
# Use a prefix for the index names that Tire uses so that the test suite doesn't
# stomp on dev data and you can work on multiple apps with ES, but keep tidy
# unadorned names for production.
unless Rails.env.production?
Tire::Model::Search.index_prefix("#{Rails.application.class.parent_name.downcase}_#{Rails.env}")
end
@ches
ches / gist:2436728
Created April 21, 2012 11:38
lolTrue
-> % ping google.com
PING google.com (173.194.38.130): 56 data bytes
64 bytes from 173.194.38.130: icmp_seq=0 ttl=49 time=121.865 ms
Request timeout for icmp_seq 1
64 bytes from 173.194.38.130: icmp_seq=2 ttl=49 time=61.171 ms
64 bytes from 173.194.38.130: icmp_seq=2 ttl=49 time=63.908 ms (DUP!)
64 bytes from 173.194.38.130: icmp_seq=2 ttl=49 time=65.723 ms (DUP!)
64 bytes from 173.194.38.130: icmp_seq=3 ttl=49 time=73.933 ms
64 bytes from 173.194.38.130: icmp_seq=3 ttl=49 time=75.050 ms (DUP!)
Request timeout for icmp_seq 4
@ches
ches / gist:1899982
Created February 24, 2012 10:22
ActionController caching context manager for testing
# Via raggi: http://stackoverflow.com/questions/5035982/optionally-testing-caching-in-rails-3-functional-tests
module ActionController::Testing::Caching
def with_caching(on = true)
caching = ActionController::Base.perform_caching
ActionController::Base.perform_caching = on
yield
ensure
ActionController::Base.perform_caching = caching
end
@ches
ches / comments_controller_spec.rb
Created February 8, 2012 00:36
RESTful controller spec examples
# This uses more real data and less mocking and stubbing for more direct and obvious code.
# It's probably easier to follow for people new to testing.
require 'spec_helper'
describe Notes::CommentsController do
let!(:commenter) { User.make! }
let!(:note) { Note.make! }
let(:comment) do
note.comments << Comment.make