Skip to content

Instantly share code, notes, and snippets.

View skippy's full-sized avatar

Adam Greene skippy

  • San Juan County, WA
View GitHub Profile
module Resque
# Raised when a worker was killed while processing a job.
class DirtyExit < RuntimeError; end
class Worker
module KillPatch
module InstanceMethods
def unregister_worker_with_error_job(*args)
if self.job
require 'sinatra/base'
class ResqueWeb < Sinatra::Base
require 'resque/server'
use Rack::ShowExceptions
# Set the AUTH env variable to your basic auth password to protect Resque.
AUTH_PASSWORD = ENV['AUTH']
if AUTH_PASSWORD
Resque::Server.use Rack::Auth::Basic do |username, password|
source "http://gemcutter.org"
gem "rails", "2.3.5"
gem 'mysql', '2.8.1'
gem "erubis", "2.6.5"
gem "rack"#, '1.0.1'
gem "resque", '1.5.0'
gem 'redis', '0.1.2'
#!/sbin/runscript
#
# Mongo init script for Gentoo
#
opts="start stop restart"
depend() {
use net
}
c = MongoMapper.database.collection('system.js')
c.save(:_id => 'sdc_test', :value => Mongo::Code.new("function(x, y){ print('within method'); return x + y + 2}"))
MongoMapper.database.eval(Mongo::Code.new('sdc_test(x,y)', :x => 3, :y => 2))
# should see 'witin method' in /var/log/mongodb/output.log
$ vm_stat
Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free: 70104.
Pages active: 451608.
Pages inactive: 146907.
Pages speculative: 25993.
Pages wired down: 91606.
"Translation faults": 335008193.
Pages copy-on-write: 18718373.
Pages zero filled: 144137680.
Adam$ script/console
Loading development environment (Rails 2.3.4)
>> Mongo::VERSION
=> "0.15.1"
>> #MongoMapper::VERSION == 0.5.5
?> document = Class.new do
?> include MongoMapper::Document
>> set_collection_name 'duplicate_id_test'
>>
?> key :data, String