Skip to content

Instantly share code, notes, and snippets.

View JoshMcKin's full-sized avatar

Joshua T. Mckinney JoshMcKin

  • New Braunfels, TX
View GitHub Profile
@JoshMcKin
JoshMcKin / gist:1648242
Created January 20, 2012 16:25
Recurring Delayed Job 2.1 in Rails 3 without patching
# Tested on DelayedJob 2.1
class MyRecurringDelayedJob
def perform
# ...some slow code
end
def success(job)
MyRecurringDelayedJob.schedule_job(job)
end
@JoshMcKin
JoshMcKin / gist:2663599
Created May 12, 2012 01:32
AWS Core SessionSigner Fiber Mutex
require 'em-synchrony/thread'
module AWS
module Core
class SessionSigner
@create_mutex = EM::Synchrony::Thread::Mutex.new
end
end
end
@JoshMcKin
JoshMcKin / stack_queue.rb
Created February 5, 2014 21:11
Stack Queue; Last in first out Queue
require 'thread'
# Borrowed from https://github.com/ruby/ruby/blob/ruby_1_9_3/lib/thread.rb#L140
# and modified for a last in first out processing
#
#
class StackQueue < Queue
# Last in first out Queue
#
# Retrieves data from the queue. If the queue is empty, the calling thread is
# suspended until data is pushed onto the queue. If +non_block+ is true, the