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
c = 1 | |
case c | |
when 1 | |
p "Name" | |
else | |
p "yeah!" | |
end | |
c == 1 # => true |
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
~wrest (master)λ gem in vimeo | |
Successfully installed vimeo-1.2.0 | |
1 gem installed | |
Installing ri documentation for vimeo-1.2.0... | |
Building YARD (yri) index for vimeo-1.2.0... | |
Updating ri class cache with 3871 classes... | |
Installing RDoc documentation for vimeo-1.2.0... | |
~wrest (master)λ irb ruby-1.8.7-p174 | |
ruby-1.8.7-p174 > require 'vimeo' | |
LoadError: no such file to load -- oauth_client |
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 'rspec' | |
module Redefiner | |
def redefine(method_name, &block) | |
self.metaclass.send(:alias_method, "__#{method_name}__", method_name) | |
self.metaclass.send(:define_method, method_name, &block) | |
end | |
def undo(method_name, &block) |
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
~ λ rgc rails3 && rgu rails3 ruby-1.8.7-p302 | |
info: Gemset 'rails3' created. | |
info: Now using gemset 'rails3' | |
~ λ /usr/bin/time gem install rails --no-rdoc --no-ri ruby-1.8.7-p302@rails3 | |
Successfully installed activesupport-3.0.0 | |
Successfully installed builder-2.1.2 | |
Successfully installed i18n-0.4.1 | |
Successfully installed activemodel-3.0.0 |
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 'net/http' | |
module Net | |
class HTTP | |
def self.enable_debug! | |
raise "You don't want to do this in anything but development mode!" unless Rails.env == 'development' | |
class << self | |
alias_method :__new__, :new | |
def new(*args, &blk) | |
instance = __new__(*args, &blk) | |
instance.set_debug_output($stderr) |
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
IO.popen('pbcopy', "w").tap{|io| io.write "some string"}.close |
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
ruby-1.8.7-p174 > u = URI.parse('http://foo:bar@localhost:3000') | |
=> #<URI::HTTP:0x101e2bc40 URL:http://foo:bar@localhost:3000> | |
ruby-1.8.7-p174 > u.user=nil | |
=> nil | |
ruby-1.8.7-p174 > u | |
=> #<URI::HTTP:0x101e2bc40 URL:http://localhost:3000> | |
ruby-1.8.7-p174 > u.to_s | |
=> "http://localhost:3000" |
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
The first myth of management is that it exists. Managers are to management as churches are to religion. |
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
FooNamespace.Routes = { | |
myResourcePath: function(){ return '<%= my_resource_path(:format => 'json') %>' } | |
} |
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
~ λ rvm jruby-head | |
~ λ ruby -v | |
jruby 1.6.0.dev (ruby 1.8.7 patchlevel 249) (2011-01-13 b9f8624) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [darwin-x86_64-java] | |
~ λ irb | |
jruby-head :001 > {:a => :b, :c => :d}.select{true} | |
=> [[:a, :b], [:c, :d]] | |
jruby-head :002 > {:a => :b, :c => :d}.select{true} | |
=> [[:a, :b], [:c, :d]] | |
jruby-head :003 > {:a => :b, :c => :d}.select{true} | |
=> [[:a, :b], [:c, :d]] |