This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pepper:showoff [ruby-1.9.2-p0@global] alex$ gem env | |
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01. | |
Gem::Specification#default_executable= called from /Users/alex/.rvm/gems/ruby-1.9.2-p0@global/specifications/cheat-1.3.0.gemspec:10. | |
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01. | |
Gem::Specification#default_executable= called from /Users/alex/.rvm/gems/ruby-1.9.2-p0@global/specifications/rake-0.8.7.gemspec:10. | |
RubyGems Environment: | |
- RUBYGEMS VERSION: 1.8.1 | |
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [x86_64-darwin10.4.0] | |
- INSTALLATION DIRECTORY: /Users/alex/.rvm/gems/ruby-1.9.2-p0@global | |
- RUBY EXECUTABLE: /Users/alex/.rvm/rubies/ruby-1.9.2-p0/bin/ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "minitest/spec" | |
MiniTest::Unit.autorun | |
module DescribeBug | |
class Foo | |
def ==(other) | |
other.is_a? Foo | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def capturing_output | |
original = $stdout | |
captured = StringIO.new | |
$stdout = captured | |
yield | |
captured.string | |
ensure | |
# allow nesting | |
if original.is_a? StringIO | |
original << captured.string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Comparison | |
@@window = 64 | |
@@prelude = 12 | |
def self.window | |
@@window | |
end | |
def self.window=(val) | |
@@window = val |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PSFR100 | |
3:53 | |
gerrycanavan: | |
PSFR 100! Anything can happen. | |
3:53 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra/base' | |
class Fail < Sinatra::Base | |
error do | |
"Failed" | |
end | |
get "/" do | |
raise "OMG" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'tlsmail' # http://rubyforge.org/projects/tlsmail/ | |
# see also http://www.stephenchu.com/2006/06/how-to-use-gmail-smtp-server-to-send.html | |
# Message - minimal emailer | |
# Author: Alex Chaffee <alex@cohuman.com> | |
# | |
# Usage: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Wraps the passed-in block in an expando/collapso triangle thingy. | |
# Uses "arrows.png" which is a sprite that I think I got from jQuery. | |
class Expando < Erector::Widget | |
needs :title, :expanded => false | |
external :js, "/lib/jquery.livequery.js" | |
external :style, <<-STYLE | |
.expando .title { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a Rack middleware component that enables ActiveRecord query caching | |
# To use, put "use QueryCaching" in your Sinatra app. | |
class QueryCaching | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
if is_static_file?(env) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == Schema Information | |
# Schema version: 10 | |
# | |
# Table name: descriptions | |
# | |
# id :integer(4) not null, primary key | |
# type :string(255) not null | |
# person_id :integer(4) not null | |
# mood_id :integer(4) not null | |
# value :integer(4) not null |