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/env ruby | |
require 'pathname' | |
remote_host = 'mmarston' | |
path_to_local_on_remote = Pathname.new('/Volumes/DevVM') | |
user_home = Pathname.new(File.expand_path('~')) | |
given_path = Pathname.new(File.expand_path(ARGV[1])) | |
command = ARGV[0] | |
dir = path_to_local_on_remote + given_path.relative_path_from(user_home) |
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
[VM] mmarston@mmarston0.dev.pages:~$ ./run_remote mate -w foo.rb | |
ssh mmarston mate /Volumes/DevVM/-w | |
[VM] mmarston@mmarston0.dev.pages:~$ 2010-06-28 16:57:51.823 mate[84317:90f] An uncaught exception was raised | |
2010-06-28 16:57:51.826 mate[84317:90f] *** -[NSArray objectAtIndex:]: index (-1 (or possibly larger)) beyond bounds (0) | |
2010-06-28 16:57:51.826 mate[84317:90f] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSArray objectAtIndex:]: index (-1 (or possibly larger)) beyond bounds (0)' | |
*** Call stack at first throw: | |
( | |
0 CoreFoundation 0x959dbbba __raiseError + 410 | |
1 libobjc.A.dylib 0x98a37509 objc_exception_throw + 56 | |
2 CoreFoundation 0x95a202f1 -[__NSArray0 objectAtIndex:] + 209 |
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
# We want to use YAML without VCR loaded, to isolate our testing to just YAML. | |
# However, the yaml files reference some VCR types, so we have to load them. | |
# Alternately, you can just copy the VCR struct definitions from: | |
# http://github.com/myronmarston/vcr/blob/v1.0.0/lib/vcr/structs.rb | |
$LOAD_PATH.unshift('path/to/vcr/lib/dir') | |
require 'vcr/structs' | |
times = 100 # do this many times to expose any intermittent YAML errors | |
dir = 'path/to/vcr/cassettes' |
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-p299 ➜ ~ irb | |
ruby-1.8.7-p299 > k = (1..3).map { |x| lambda { x } } | |
=> [#<Proc:0x0000000100454f10@(irb):1>, #<Proc:0x0000000100454f10@(irb):1>, #<Proc:0x0000000100454f10@(irb):1>] | |
ruby-1.8.7-p299 > k[0].call | |
=> 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
"\e[A": history-search-backward | |
"\e[B": history-search-forward |
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' | |
class Base | |
def static1; :static1; end | |
def static2; :static2; end | |
define_method :dynamic1 do :dynamic1; end | |
define_method :dynamic2 do :dynamic2; 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
require 'rubygems' | |
require 'activerecord' | |
if false | |
require 'ruby-debug' | |
Debugger.start | |
Debugger.settings[:autoeval] = true if Debugger.respond_to?(:settings) | |
end | |
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => 'request_times.db') |
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 self.define_shared_group_method(new_name, report_label=nil) | |
report_label = "it should behave like" unless report_label | |
module_eval(<<-END_RUBY, __FILE__, __LINE__) | |
def self.#{new_name}(name, &customization_block) | |
shared_block = world.shared_example_groups[name] | |
raise "Could not find shared example group named \#{name.inspect}" unless shared_block | |
providings = extract_providings(customization_block) | |
describe "#{report_label} \#{name}" do |
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
sudo touch {access,common,exception,metric,mongrel,traffic_click,traffic_feature,traffic_track,unicorn,wpn-traffic}.log | |
sudo chown rails:rails {access,common,exception,metric,mongrel,traffic_click,traffic_feature,traffic_track,unicorn,wpn-traffic}.log | |
sudo chmod 664 {access,common,exception,metric,mongrel,traffic_click,traffic_feature,traffic_track,unicorn,wpn-traffic}.log |
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
[VM] ~/dev/web/wpn_rails/test(bug_32965)$ ruby erb_rendering_benchmarks.rb | |
user system total real | |
ERB rendering using ActionView 0.680000 0.150000 0.830000 ( 0.836579) | |
ERB rendering using just ERB with no class cache 3.290000 0.220000 3.510000 ( 3.504252) | |
ERB rendering using just ERB and a class cache 1.800000 0.200000 2.000000 ( 2.008031) | |
Using a lambda 0.020000 0.020000 0.040000 ( 0.045059) |