Skip to content

Instantly share code, notes, and snippets.

myronmarston /
Created Nov 5, 2015 — forked from pnc/
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
View learn_sequel_model_spec.rb
require "sequel"
# Connect to the DB to make sequel happy. It expects a DB connection when you subclass Sequel::Model
DB = Sequel.sqlite
# Use the module to avoid naming collisions with other specs.
module LearnSequelModelSpec
# Where can I safely declare this class without specifying
# the database for it?!
View queues.rb
➜ 8549841 git:(master) ✗ ruby queues.rb
Popping before put
popped job:
popped job:
popped job:
popped job:
popped job:
popped job:
popped job:
popped job:
View Gemfile
# A sample Gemfile
source ""
gem 'vcr'
gem 'fakefs'
gem 'typhoeus'
gem 'fakeweb'
gem 'rspec'
gem 'rr'
myronmarston / test_it.rb
Created Aug 7, 2012 — forked from jrochkind/test_it.rb
VCR, WebMock, HTTPClient weirdness
View test_it.rb
require 'httpclient'
require 'vcr'
require 'webmock'
require 'test/unit'
# To allow us to do real HTTP requests in a VCR.turned_off, we
# have to tell webmock to let us.
VCR.configure do |c|
View triangle.rb
TriangleError =
Triangle =, :y, :z) do
def initialize(*args)
def type
myronmarston / some_spec.rb
Created Apr 16, 2012 — forked from tommeier/some_spec.rb
VCR with placeholders
View some_spec.rb
use_vcr_cassette 'some/cassette', :tag => :bad_staging_api
myronmarston / some_spec.rb
Created Mar 20, 2012 — forked from stevenharman/some_spec.rb
Using Rspec's "let" inside an "it" block. Crazy? Yes. Useful? Occasionally.
View some_spec.rb
describe "#mentions_story?" do
subject { }
let(:file) { "COMMIT_EDITMSG" }
def set_file_contents(text)
File.stub(:read).with(file) { example_commit_message(text) }
context "commit message contains the special Pivotal Tracker story syntax" do
myronmarston / my_class_spec.rb
Created Mar 4, 2012 — forked from pat/gist:1947369
Using rspec-fire?
View my_class_spec.rb
# My normal approach:
require './path/to/my_class'
describe MyClass do
let(:my_class) { }
describe '#add_widget' do
it "makes a widget using OtherClass" do
other_class = fire_replaced_class_double("OtherClass")
myronmarston / gist:1684632
Created Jan 26, 2012 — forked from justinko/gist:1684051
Methods to aid in testing without loading the Rails environment
View gist:1684632
def stub_model(model_name)
stub_class model_name, ActiveRecord::Base
def stub_class(class_name, super_class = Object)
stub_module class_name,
def stub_module(module_name, object =
module_name = module_name.to_s.camelize