Time taken with following command:
time bundle exec rake routes
twice for every MRI 1.9.3 variation explained
in this blogpost
for my OpenProject installation.
- 1.9.3
real 0m18.319s user 0m15.929s
sys 0m1.452s
NoMethodError: undefined method `compile' for nil:NilClass | |
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/coffee-script-2.1.1/lib/coffee_script.rb:170:in `compile' | |
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/tilt-1.1/lib/tilt.rb:618:in `evaluate' | |
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/tilt-1.1/lib/tilt.rb:128:in `render' | |
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/sinatra-1.1.0/lib/sinatra/base.rb:452:in `render' | |
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/sinatra-1.1.0/lib/sinatra/base.rb:418:in `coffee' | |
metacello.rb:138:in `GET /javascript/:name.js' | |
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/sinatra-1.1.0/lib/sinatra/base.rb:1032:in `call' | |
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/sinatra-1.1.0/lib/sinatra/base.rb:1032:in `compile!' | |
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/sinatra-1.1.0/lib/sinatra/base.rb:620:in `instance_eval' |
require 'nokogiri' | |
require 'open-uri' | |
# thanks to Rosalily for the list of insults | |
doc = Nokogiri::HTML(open('http://www.cloudnet.com/~renfest/insults.htm')) | |
# works fine if you need positive feedback too ;) | |
# http://hubpages.com/hub/List-Of-Positive-Daily-Affirmations | |
insults = doc.at_css('body ul ul ul ul ul').children.select {|c| c.name =='li'}.map {|c| c.children[0].text} | |
loop { %x{ say "#{insults.shuffle.first.upcase}"; sleep #{rand(10000)+1000} } } |
Time taken with following command:
time bundle exec rake routes
twice for every MRI 1.9.3 variation explained
in this blogpost
for my OpenProject installation.
real 0m18.319s
user 0m15.929s
sys 0m1.452s
Disclaimer: I used these instructions and the ubuntu_mvm script to build a Newspeak VM. However, this should be easily adaptable to a Squeak Cog build. It probably works on other modern linux systems, but I haven't tested any other distro. Please tell me if it does (not) work for you.
require 'ostruct' | |
include ActionView::Helpers::FormOptionsHelper | |
# fake ActiveRecord models | |
class Continent < OpenStruct | |
#attr_accessor :id, :name, :countries | |
def initialize(*args) | |
super |
[...] | |
Installing debugger-ruby_core_source (1.2.2) | |
Installing debugger (1.6.0) | |
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. | |
/home/travis/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb | |
checking for rb_method_entry_t.called_id in method.h... no |
class SnakeHash < SimpleDelegator | |
def []=(arg1, arg2) | |
puts "!!1!" | |
@delegate_sd_obj[arg1] = arg2 | |
end | |
end | |
#[2] pry(main)> h = SnakeHash.new(Hash.new) | |
#=> {} | |
#[3] pry(main)> h[2] |
Entry = Struct.new(:timestamp, :clientID, :objectID, :size, :method, :status, :type, :server) do | |
REGIONS = [:SantaClara, :Plano, :Herndon, :Paris] | |
PROTOCOLS = [:HTTP_09, :HTTP_10, :HTTP_11, :HTTP_XX] | |
METHODS = [:get, :head, :post, :put, :delete, :trace, :options, :connect, :other] | |
STATUS_CODES = [100, 101, 200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 500, 501, 502, 503, 504, 505, :other] | |
FILE_TYPES = [:html, :image, :audio, :video, :java, :formatted, :dynamic, :text, :compressed, :programs, :directory, :icl, :other] | |
def self.parse(bytes) | |
values = bytes.unpack("NNNNCCCC") | |
entry = self.new |
ruby --version | |
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux] | |
ruby bench.rb | |
user system total real | |
babai1 1.700000 0.000000 1.700000 ( 1.707292) | |
babai2 29.630000 0.010000 29.640000 ( 29.769966) |
require 'benchmark' | |
iterations = 10_000 | |
arr = Array.new(1000) { Array.new(2) << (rand()*100).to_s} | |
def use_map_join(arr) | |
arr.map {|a| a[2]}.join ', ' | |
end | |
def use_inject(arr) | |
join_str = ', ' |