This file contains hidden or 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
# Toss this in your ~/.irbrc file for a convenient way | |
# to peruse Ruby source code in TextMate. This | |
# only works in Ruby 1.9! | |
# | |
# Use it in irb like so: | |
# | |
# >> require 'active_record' | |
# >> ActiveRecord::Base.source_for_method(:create) | |
class Object |
This file contains hidden or 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
# encoding: utf-8 | |
Encoding.default_external = 'utf-8' | |
Encoding.default_internal = 'utf-8' | |
ENV["LANG"] = 'en_US.UTF-8' | |
require 'psych' if ARGV.first == 'p' | |
require 'yaml' | |
puts 'hello: "h\xc3\xa4gar"' |
This file contains hidden or 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
# encoding: iso8859-1 | |
require 'yaml' | |
x = "Antonio Giménez Muñoz" | |
x.force_encoding('BINARY') | |
p x.encode('UTF-8') |
This file contains hidden or 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 'spec_helper' | |
describe "Registration" do | |
before(:all) do | |
FakeWeb.allow_net_connect = true | |
end | |
after(:all) do | |
FakeWeb.allow_net_connect = false |
This file contains hidden or 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
$ ruby --version | |
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0] | |
$ ruby yaml_bug.rb | |
YAML modifies strings when it serializes them! | |
Original: "1\n \n2" | |
Modified: "1\n\n2" |
This file contains hidden or 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 'sinatra' | |
require 'json' | |
require 'addressable/uri' | |
require File.expand_path('rack_stereoscope.rb', File.dirname(__FILE__)) | |
configure do | |
use Rack::Reloader; | |
use Rack::Lint; | |
use Rack::Stereoscope; | |
end |
NewerOlder