Skip to content

Instantly share code, notes, and snippets.

@etehtsea
etehtsea / config.ru
Created February 29, 2012 13:56
heroku ENV
# Example 5-18.
$LOAD_PATH.unshift 'lib'
require 'blog'
#if ENV['URL'] and ENV['DATABASE_URL']
if ENV['HOME'] == '/app'
# we're on heroku, no cache needed
# also, it's a read-only file system
GithubHook.disable :autopull
elsif Blog.production?
#!/usr/bin/env ruby
require "benchmark"
def method1(ar)
(ar.first..ar.last).to_a - ar
end
def method2(ar)
result_ar, prev = [], 0
ar.each do |e|
kes@ubuntu-vbox:~/Downloads$ gem i jruby-launcher --backtrace
Fetching: jruby-launcher-1.0.8-java.gem (100%)
ERROR: While executing gem ... (ArgumentError)
wrong number of arguments (2 for 1)
/home/kes/.rvm/rubies/jruby-head-n16/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:57:in `initialize'
/home/kes/.rvm/rubies/jruby-head-n16/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:64:in `each'
org/jruby/RubyKernel.java:1419:in `loop'
/home/kes/.rvm/rubies/jruby-head-n16/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:55:in `each'
/home/kes/.rvm/rubies/jruby-head-n16/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:35:in `initialize'
/home/kes/.rvm/rubies/jruby-head-n16/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:20:in `open'
$ hello.rb -sv
[729:INFO] 2011-08-15 20:45:13 :: Starting server on 0.0.0.0:9000 in development mode. Watch out for stones.
[729:ERROR] 2011-08-15 20:45:24 :: undefined method `each' for nil:NilClass
[729:ERROR] 2011-08-15 20:45:24 :: /Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/rack-1.3.2/lib/rack/utils.rb:344:in `initialize'
/Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/rack-1.3.2/lib/rack/utils.rb:338:in `new'
/Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/rack-1.3.2/lib/rack/content_length.rb:15:in `call'
/Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/async-rack-0.5.1/lib/async_rack/async_callback.rb:114:in `call'
/Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/async-rack-0.5.1/lib/async_rack/async_callback.rb:127:in `async_callback'
org/jruby/RubyMethod.java:121:in `call'
/Users/kes/.rvm/gems/jruby-1.6.3@goliath/gems/goliath-0.9.2/lib/goliath/rack/async_middleware.rb:71:in `call'
(in /Users/kes/Projects/goliath)
/Users/kes/.rvm/rubies/jruby-1.6.3/bin/jruby -S bundle exec rspec spec/integration/echo_spec.rb spec/integration/empty_body_spec.rb spec/integration/http_log_spec.rb spec/integration/keepalive_spec.rb spec/integration/pipelining_spec.rb spec/integration/rack_routes_spec.rb spec/integration/reloader_spec.rb spec/integration/template_spec.rb spec/integration/trace_spec.rb spec/integration/valid_spec.rb spec/unit/api_spec.rb spec/unit/connection_spec.rb spec/unit/env_spec.rb spec/unit/headers_spec.rb spec/unit/request_spec.rb spec/unit/response_spec.rb spec/unit/runner_spec.rb spec/unit/server_spec.rb spec/unit/rack/builder_spec.rb spec/unit/rack/default_mime_type_spec.rb spec/unit/rack/heartbeat_spec.rb spec/unit/rack/params_spec.rb spec/unit/rack/render_spec.rb spec/unit/rack/formatters/json_spec.rb spec/unit/rack/formatters/plist_spec.rb spec/unit/rack/formatters/xml_spec.rb spec/unit/rack/formatters/yaml_spec.rb spec/unit/rack/validation/boolean_value_spec.rb spec/unit/rack/v
rails@newvirt:~/Projects/crm/current$ rvm current
Using /usr/local/rvm/gems/ruby-1.9.2-p180 with gemset crm
ruby-1.9.2-p180@crm
rails@newvirt:~/Projects/crm/current$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
rails@newvirt:~/Projects/crm/current$ rvm --trace use 1.9.2@crm
+ [[ -n '' ]]
+ export 'PS4=+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ PS4='+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ /scripts/cli : __rvm_parse_args() 718 > [[ -z '' ]]
+ /scripts/cli : __rvm_parse_args() 718 > [[ -n '' ]]
+ /scripts/cli : __rvm_parse_args() 720 > [[ 0 -eq 1 ]]
+ /scripts/cli : __rvm_parse_args() 720 > [[ -n '' ]]
+ /scripts/cli : __rvm_parse_args() 35 > [[ -n use ]]
+ /scripts/cli : __rvm_parse_args() 37 > rvm_token=use