Skip to content

Instantly share code, notes, and snippets.

class Hero
attr_reader :hp
def initialize
@hp = 100
end
def hit!(force)
@hp -= force
end
@russ
russ / v1.rb
Created December 27, 2011 19:58
require "rubygems"
require "sequel"
DB = Sequel.connect("sqlite://urls.db")
class Url < Sequel::Model
plugin :schema
set_schema do
primary_key(:id)
@russ
russ / gist:1524858
Created December 27, 2011 19:21
Base62
class Base62
@@ranges = [
('0'..'9'),
('a'..'z'),
('A'..'Z')
]
@@base = nil
@@offsets = nil
def self.to_s(number)
<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) {
rake qu:work QUEUES=urgent,default
3.times do |n|
worker = Delayed::Worker.new
worker.name = 'worker-' + n.to_s
worker.start
end
rake jobs:work
QUEUE=* rake resque:work
QUEUE=notifications rake resque:work
COUNT=5 QUEUE=* rake resque:workers
MyApplication::Application.routes.draw do
mount Resque::Server.new, :at => "/resque"
end
*/50 * * * * /bin/bash cd /rails/root/ && rake calculate::pi > /dev/null 2>&1