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
Persistence | |
See what's pending | |
Modify pending jobs in-place | |
Tags | |
Priorities | |
Fast pushing and popping | |
See what workers are doing | |
See what workers have done | |
See failed jobs | |
Kill fat 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
module Faraday | |
class Adapter | |
class EMHttpRequest < Faraday::Adapter | |
self.supports_parallel_requests = true | |
def self.setup_parallel_manager(options = {}) | |
EMParallelManager.new | |
end | |
class EMParallelManager |
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
source :gemcutter | |
gem 'em-http-request', :git => 'https://github.com/igrigorik/em-http-request.git' | |
gem 'thin' |
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
# Resque job to do the true outbound sending | |
class DeliverEmailJob | |
include ProjectName::Job::Logging | |
@queue = :mail_queue | |
def self.perform(args) | |
message = QueuedEmail.get!(args["message_id"]) | |
logger.info("Delivering (%s) to %s" % [message.subject, message.formatted_recipient]) |
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
ActiveAdmin::Dashboards.build do | |
# Add this section in your dashboard... | |
section "Background Jobs" do | |
now = Time.now.getgm | |
ul do | |
li do | |
jobs = Delayed::Job.where('failed_at is not null').count(:id) | |
link_to "#{jobs} failing jobs", admin_jobs_path(q: {failed_at_is_not_null: true}), style: 'color: red' | |
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
### INSTALLATION NOTES ### | |
# 1. Install Homebrew (https://github.com/mxcl/homebrew) | |
# 2. brew install zsh | |
# 3. Install OhMyZsh (https://github.com/robbyrussell/oh-my-zsh) | |
# 4. brew install reattach-to-user-namespace --wrap-pbcopy-pbpaste && brew link reattach-to-user-namespace | |
# 5. Install iTerm2 | |
# 6. In iTerm2 preferences for your profile set: | |
# Character Encoding: Unicode (UTF-8) | |
# Report Terminal Type: xterm-256color | |
# 7. Put itunesartist and itunestrack into PATH |
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
# Chained comparisons in Ruby | |
# inspired by http://coffeescript.org/#comparisons | |
# as well as http://refactormycode.com/codes/1284 | |
[:<, :>, :<=, :>=].each do |operator| | |
[Float, Fixnum, Rational, Comparable].each do |klass| | |
klass.class_eval do | |
alias_method "_#{operator}", operator | |
define_method operator do |rhs| | |
send("_#{operator}", rhs) && rhs |
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
# | |
# About the vulnerability: | |
# | |
# http://seclists.org/oss-sec/2012/q2/503 | |
# | |
# This code is for Rails 2.3 series only. Tested on 2.3.14. | |
# | |
# Put this file into lib/rails_patches directory | |
# then include it in one of your config/initializers. | |
# |
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
#!/bin/bash | |
# Applies the Monokai color scheme to the current terminal session. | |
declare -A map0 | |
map0=( [foreground ]='#F8F8F2' [background ]='#272822' | |
[cursor ]='#F8F8F0' [selection ]='#49483E' | |
[pink ]='#F92672' [green ]='#A6E22E' | |
[yellow ]='#E6DB74' [blue ]='#66D9EF' | |
[purple ]='#AE81FF' [orange ]='#FD971F' | |
[gray ]='#75715E' ) |
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
require 'date' | |
class Date | |
if RUBY_VERSION < '1.9' | |
## accept 1.9 marshaled data on 1.8 | |
## based on ext/date/date_core.c d_lite_marshal_dump_old | |
def marshal_load(data) | |
nth, jd, df, sf, of, @sg = data | |
real_jd = |
OlderNewer