This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Base62 | |
@@ranges = [ | |
('0'..'9'), | |
('a'..'z'), | |
('A'..'Z') | |
] | |
@@base = nil | |
@@offsets = nil | |
def self.to_s(number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
<script> | |
$(document).ready(function() { | |
$.ajax({ | |
type: "HEAD", | |
async: true, | |
url: "http://bashme.org/phd_18yo_apriloneil2_trailer.mov", | |
success: function(message, text, response) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rake qu:work QUEUES=urgent,default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3.times do |n| | |
worker = Delayed::Worker.new | |
worker.name = 'worker-' + n.to_s | |
worker.start | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rake jobs:work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QUEUE=* rake resque:work | |
QUEUE=notifications rake resque:work | |
COUNT=5 QUEUE=* rake resque:workers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyApplication::Application.routes.draw do | |
mount Resque::Server.new, :at => "/resque" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*/50 * * * * /bin/bash cd /rails/root/ && rake calculate::pi > /dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NotifierJob | |
@queue = :urgent | |
def self.perform(user) | |
Notifier.welcome(user).deliver | |
end | |
end | |
Qu.enqueue(NotifierJob, User.last) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Queue | |
@@jobs = [] | |
def self.enqueue(klass, *arguments) | |
@@jobs << { :class => klass, :arguments => arguments } | |
end | |
def self.work | |
while job = @@jobs.shift | |
puts job[:class].perform(*job[:arguments]) |