Skip to content

Instantly share code, notes, and snippets.

View jballanc's full-sized avatar

Joshua Ballanco jballanc

View GitHub Profile
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
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)
@jballanc
jballanc / uh-oh-scope.rb
Created October 31, 2011 21:17
Different behavior of class_eval between Ruby 1.9.2 and Ruby 1.9.3
# 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
# 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
anonymous
anonymous / gist:1225837
Created September 19, 2011 01:51
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
# 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.
@alloy
alloy / NSURLConnection.rb
Created March 24, 2011 14:16
MacRuby NSURLConnection example.
framework 'AppKit'
class Download
attr_reader :response, :responseBody
def start(request)
puts "START!"
NSURLConnection.connectionWithRequest(request, delegate:self)
end
@0xced
0xced / CopyLaunchedApplicationsInFrontToBackOrder.c
Created August 7, 2009 14:06
Get an array of running applications ordered by last use
#import <Carbon/Carbon.h>
#import <dlfcn.h>
/*
* Returns an array of CFDictionaryRef types, each of which contains information about one of the processes.
* The processes are ordered in front to back, i.e. in the same order they appear when typing command + tab, from left to right.
* See the ProcessInformationCopyDictionary function documentation for the keys used in the dictionaries.
* If something goes wrong, then this function returns NULL.
*/
CFArrayRef CopyLaunchedApplicationsInFrontToBackOrder(void)
require 'test/unit'
require 'rubygems'
require 'shoulda'
require 'factory_girl'
require 'dm-core'
require 'dm-validations' # Needed for save!
class User