Skip to content

Instantly share code, notes, and snippets.

@rednaxelafx
rednaxelafx / prettyprint.js
Created January 20, 2011 03:03
Pretty print JavaScript objects (does not conform to JSON, because we don't want escape sequences in string literals)
function isPlainObject(o) {
return o && toString.call(o) === '[object Object]' && 'isPrototypeOf' in o;
}
function isArray(o) {
return toString.call(o) == '[object Array]';
}
function objectToString(val) {
var INDENT = '  ';
# config/initializers/delayed_job_mongoid.rb
module Delayed
module Backend
module ActiveRecord
class Job < ::ActiveRecord::Base
def self.before_fork
::ActiveRecord::Base.clear_all_connections!
::Mongoid.master.connection.close
end