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 ApiResponder < ActionController::Responder | |
# MRSS is not a 'real' type. | |
# The Media RSS specification builds on top of the RSS | |
# specification. We want to use the following formats | |
# in our application... | |
# - xml | |
# - json | |
# - rss | |
# - mrss |
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
module Stuff | |
def create_dynamic_method | |
end | |
end | |
class Foo | |
extend Stuff | |
# Tells you what is static | |
# |
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 A | |
@@a = 1 | |
def val | |
@@a += 1 | |
end | |
end | |
class B < A | |
@@a = 2 | |
def 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
--type-add=objc=.pch | |
--type-set=xcode=.pbxproj,.pbxuser,.perspectivev3 | |
--type-set=ragel=.rl | |
--type-set=nib=.xib | |
--type-set=plist=.plist | |
--type-set=tmstuff=.tmproj,.tm_build_errors | |
--nonib | |
--notmstuff | |
--noxcode |
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
[user] | |
# email = ... | |
# name = ... | |
# [color] | |
# branch = auto | |
# diff = auto | |
# status = auto | |
# [color "branch"] | |
# current = yellow reverse |
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
# I found I had to do this in my Gemfile to get Bundler to load Rails 2.3.5 | |
gem 'rails', '2.3.5', :require => nil | |
gem 'builder', '2.1.2' | |
gem 'tzinfo', '0.3.16' | |
gem 'i18n', '0.3.3' | |
gem 'tmail', '1.2.6' |
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
namespace :deploy do | |
namespace :gate do | |
task :default do | |
if "#{stage}" == "production" | |
stg = CLI.ui.ask "Which environment are you deploying to again? " | |
unless stg == "#{stage}" | |
puts "I am not convinced, sorry." | |
exit(1) | |
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
require 'timeout' | |
def test_timeout(timeout_timeout, count, &block) | |
pass = timeout = error = 0 | |
count.times do |i| | |
begin | |
Timeout::timeout(timeout_timeout, &block) | |
pass += 1 | |
rescue Timeout::Error => e | |
timeout += 1 |
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
#!/usr/bin/ruby | |
xml_str = %Q{<peon> | |
<id>96586</id> | |
<stdout><![CDATA[This is STDOUT]]></stdout> | |
<stderr><![CDATA[This is STDERR]]></stderr> | |
</peon>} | |
require 'rubygems' | |
# gem 'hpricot', '0.6' |
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 to_xml(options={}) | |
options[:procs] ||= [] | |
options[:procs] << Proc.new() do |options| | |
options[:builder].tag!('big-image-url', "http://#{EMAIL_DOMAIN_NAME}#{big_image.uri_path}") | |
end | |
super | |
end | |
<<EOF | |
That code produces... |
NewerOlder