This will run the loans queue with the weight of 5
bundle exec sidekiq -q loans,5
SO: How to run Sidekiq in production
This will run the loans queue with the weight of 5
bundle exec sidekiq -q loans,5
SO: How to run Sidekiq in production
Get a deserialized object from a delayed job: | |
1. Get the delayed_job record using the id: dj = DelayedJob.find(<id>) | |
2. Get the handler field from dj: dj.handler | |
3. Convert it from YAML: YAML.parse(dj.handler) | |
4. You can get the ruby objects that the delayed job was built with by converting that to_ruby and calling the object: | |
YAML.parse(dj.handler).to_ruby.user | |
YAML.parse(dj.handler).to_ruby.prospect | |
YAML.parse(dj.handler).to_ruby.agent | |
etc. |
import UIKit | |
typealias TableInfo = [String: Any] | |
typealias TableSectionArray = [TableSection] | |
typealias TableRowArray = [TableRow] | |
enum TableRowType { | |
case Text | |
case Detail | |
case Subtitle |
class ImportJob | |
include Sidekiq::Worker | |
sidekiq_options :queue => :import, :retry => false, :backtrace => true | |
def perform(project_id) | |
# create master batch | |
a = Sidekiq::Batch.new | |
a.description = "Master Batch A" | |
a.on(:success, "ImportJob#on_success", {"step" => "a"}) | |
logger.info "Master Batch A starting #{a.bid}" |
// Run this in the F12 javascript console in chrome | |
// if a redirect happens, the page will pause | |
// this helps because chrome's network tab's | |
// "preserve log" seems to technically preserve the log | |
// but you can't actually LOOK at it... | |
// also the "replay xhr" feature does not work after reload | |
// even if you "preserve log". | |
window.addEventListener("beforeunload", function() { debugger; }, false) |
# As used with CanCan and Devise | |
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
include ErrorResponseActions | |
rescue_from CanCan::AccessDenied, :with => :authorization_error | |
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found | |
before_filter :authenticate! |
import Foundation | |
/// Parse RFC 3339 date string to NSDate | |
/// | |
/// :param: rfc3339DateTimeString string with format "yyyy-MM-ddTHH:mm:ssZ" | |
/// :returns: NSDate, or nil if string cannot be parsed | |
public func dateForRFC3339DateTimeString(rfc3339DateTimeString: String) -> NSDate? { | |
let formatter = getThreadLocalRFC3339DateFormatter() | |
return formatter.dateFromString(rfc3339DateTimeString) | |
} |
stats = Sidekiq::Stats.new | |
stats.queues | |
stats.enqueued | |
stats.processed | |
stats.failed |
// Highcharts CheatSheet Part 1. | |
// Create interactive charts easily for your web projects. | |
// Download: http://www.highcharts.com/download | |
// More: http://api.highcharts.com/highcharts | |
// 1. Installation. | |
// Highcharts requires two files to run, highcharts.js and either jQuery, MooTools or Prototype or the Highcharts Standalone Framework which are used for some common JavaScript tasks. | |
// <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
// <script src="https://code.highcharts.com/highcharts.js"></script> |