Skip to content

Instantly share code, notes, and snippets.

View gist:371872
# this is a DSL example, anonymized from a production usecase, showing
# deployment to an A/B shared server system from multiple sources.
# note that in this example that while there are many servers to restart,
# the code is deployed to a shared drive.
application 'example' do
server_set = environment.example_test_server
cgi_bin_dir = environment.example_dir + '/cgi_bin' + server_set
web_dir = environment.example_dir + '/web'
# remove some paths in the destination
View gist:466267
# in config/environments/production.rb
config.after_initialize do
# in lib/ssh_tunnel.rb
class SshTunnel
@@process_id = nil
COMMAND = "ssh mpearson@redacted.locationB -R 9988:localhost:3000 -N -T -o PasswordAuthentication=no"
View gist:668557
[2010-11-09 11:42:08] ./installer -a /Users/mpearson/.rvm/rubies/ree-1.8.7-2010.02 --dont-install-useful-gems
./configure: line 4633: : command not found
rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
configure: WARNING: Could not find the PC. Will not output failed addresses...
In file included from src/base/commandlineflags.h:55,
from src/
./src/base/basictypes.h: In constructor ‘AssignAttributeStartEnd::AssignAttributeStartEnd(const char*, char**, char**)’:
./src/base/basictypes.h:251: warning: ‘_dyld_present’ is deprecated (declared at /usr/include/mach-o/dyld.h:237)
./src/base/basictypes.h:251: warning: ‘_dyld_present’ is deprecated (declared at /usr/include/mach-o/dyld.h:237)
View progress_emo_formatter.rb
# See for info on how to use custom formatters in rspec 1.x
require 'spec/runner/formatter/progress_bar_formatter'
class ProgressEmoFormatter < Spec::Runner::Formatter::ProgressBarFormatter
@@num_consecutive_failures = 0
def example_failed(example, counter, failure)
mipearson / gist:794570
Created Jan 25, 2011
Hi to RORO Members
View gist:794570
I am looking for a Senior Ruby Developer with a Java background to
start as soon as possible, you will be working in a paired agile
environment developing Ruby coding. Using Selenium/Cucumber for
automation testing.
Immediate Start
3 Month Contract
Competitive Rate circa $600 per day including Super (PAYG/ABN: PTY
mipearson / ci.rb
Created Feb 3, 2011
Chatty hudson blamer
View ci.rb
#!/usr/bin/env ruby
require 'fileutils'
def last_committer
@last_committer ||= `git log --format="%an" -1`.strip
%s is a bad programmer and
View lolwut jruby stacktrace
log4j:ERROR setFile(null,true) call failed. /var/log/puge/puge.log (Permission denied)
at Method)
at org.apache.log4j.FileAppender.setFile(
at org.apache.log4j.FileAppender.activateOptions(
at org.apache.log4j.DailyRollingFileAppender.activateOptions(
at org.apache.log4j.config.PropertySetter.activate(
at org.apache.log4j.config.PropertySetter.setProperties(
mipearson / cfn_dsl_mockup.rb
Created Feb 28, 2011
Mockup for a DSL to generate Amazon CloudFormation configurations
View cfn_dsl_mockup.rb
# Based on half of
# Methods beginning with a lowercase letter are 'native' and have special behaviour.
# Methods beginning with an uppercase letter get literally transformed into JSON
templates do
Alarm do
EvaluationPeriods 1
Statistic 'Average'
Period 60
AlarmActions: ref('AlarmTopic')
mipearson / config.rb
Created Mar 15, 2011
.. an example of mocking gone too far.
View config.rb
## configuration_spec.rb
require 'spec_helper'
describe Configuration do
context "with the configuration variable set " do
before do
@config = => 'hello', :value => 'goodbye')
mock(Configuration).find_by_key('hello') { @config }
View mongoid dm.rb
class Match
include Mongoid::Document
include Mongoid::Timestamps # adds created_at and updated_at fields
field :scheduled_start, :type => Date
field :status
embeds_one :home_team
embeds_one :away_team