rw----: private group (admin can read)rwr---: collab. read-onlyrwra--: collab. read-annotate
r-----: and
| require 'test/unit' | |
| require 'rubygems' | |
| require 'shoulda' | |
| require 'factory_girl' | |
| require 'dm-core' | |
| require 'dm-validations' # Needed for save! | |
| class User | |
| framework 'AppKit' | |
| class Download | |
| attr_reader :response, :responseBody | |
| def start(request) | |
| puts "START!" | |
| NSURLConnection.connectionWithRequest(request, delegate:self) | |
| end |
| # following is a little benchmark looking a real world example of inserting a | |
| # bunch of records into pg and mongo using a few methods available in ruby. | |
| # | |
| # the code inserst a value with a simple uniq contraint and then looks it up. | |
| # | |
| # this is not meant to be an apples to apples benchmark, rather it's trying to | |
| # see how the various dbs might perform in a real world situation. i know | |
| # mongo does not fsync to disk. i know it's not fair using a transaction with | |
| # the rdbms, but these conditions will exist in real world usage and it's that | |
| # which i'm interested in. |
| l = ->(a = 'ichi', b = 'ni', c = 'san') { puts "#{a}, #{b}, #{c}" } | |
| p l.arity # => -1 in JRuby, 0 in MRI...no good answer | |
| def l.arity; 3; end # force to "3" so curry delays evaluation | |
| c = l.curry | |
| c.('one').('two').('three') # => one, two, three |
| # Both examples work under Ruby 1.9.2, but not under Ruby 1.9.3 (and yes, I | |
| # realize both are bad practice anyway...): | |
| # 1. | |
| def test(foo, &block) | |
| end | |
| test 'hello', do; end | |
| # 2. | |
| class Foo; end |
| # Compare the results running under Ruby 1.9.2 and Ruby 1.9.3 | |
| class Foo | |
| def initialize | |
| @@value = "Set from Foo initialize" | |
| end | |
| def report | |
| @@value | |
| end | |
| end |
| diff --git a/load.c b/load.c | |
| index b070a120ac25cc07bcca478f8b584f885c593566..d53e06ef5e243ac5577756285997e051314248c8 100644 | |
| --- a/load.c | |
| +++ b/load.c | |
| @@ -298,6 +298,23 @@ rb_f_require_imp(VALUE obj, SEL sel, VALUE fname) | |
| return rb_f_require(obj, fname); | |
| } | |
| +VALUE | |
| +rb_f_require_relative(VALUE obj, VALUE fname) |
| 08:41:30,006 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Stats for Queue /queues/foo | |
| 08:41:30,006 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Paused: false | |
| 08:41:30,006 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Temporary: false | |
| 08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Message Count: 0 | |
| 08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Delivering Count: 0 | |
| 08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Scheduled Count: 0 | |
| 08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Messages Added Since Creation: 6 | |
| 08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Consumer Count: 1 | |
| 08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Expiry Address: jms.queue.ExpiryQueue | |
| 08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Dead Letter Address: jms.queue.DLQ |
| #!/usr/bin/env ruby | |
| mem = Array.new(30_000) | |
| iptr = dptr = 0 | |
| prog = File.read ARGV.first | |
| jmp = lambda { |op, a, b| | |
| (iptr = iptr.send(op, 1); jmp.call(op, a, b) if prog[iptr] == a) until prog[iptr] == b | |
| } | |
| nop = lambda {} | |
| cmds = { | |
| '>' => lambda { dptr += 1 }, |