Skip to content

Instantly share code, notes, and snippets.

@myronmarston
myronmarston / module_stubbing.rb
Created December 22, 2011 07:05 — forked from justinko/gist:1509034
Avdi Grimm's creation, pulled from Objects on Rails
module ModuleStubbing
def stubbed_modules
@stubbed_modules ||= []
end
def stub_module(full_name)
most_shallow_stubbed_module = nil
full_name.to_s.split(/::/).inject(Object) do |context, name|
begin
@myronmarston
myronmarston / dry.rb
Created August 18, 2011 21:13 — forked from Fluxx/dry.rb
day = case self.type
when 'fast' then :fast_completion_day
when 'super_fast' then :super_fast_completion_day
when 'ludicrous' then :ludicrous_completion_day
else :budget_completion_day
end
self.value = Increment.first.max_hours * Incrementor.first.send(day)
@myronmarston
myronmarston / gist:1046700
Created June 25, 2011 17:42 — forked from clarkware/gist:1046693
View Source for Ruby
# Toss this in your ~/.irbrc file for a convenient way
# to peruse Ruby source code in TextMate.
#
# Use in irb like so:
#
# >> require 'active_record'
# >> ActiveRecord::Base.source_for_method(:create)
class Object
def source_for_method(method)
module Starfish
module AwsS3
# S3Archive initializes and provides archival-oriented access to an S3 bucket.
class S3Archive
def initialize
config = YAML.load_file("#{File.expand_path('~')}/.ec2/aws-secret.yml")
AWS::S3::Base.establish_connection!(
:access_key_id => config['aws']['access_key'],
require 'rubygems'
require 'httpclient'
require 'vcr'
require 'savon'
require 'test/unit'
VCR.config do |c|
c.cassette_library_dir = 'fixtures/cassettes'
c.stub_with :webmock
end