Skip to content

Instantly share code, notes, and snippets.

View ccurtisj's full-sized avatar

Christopher Curtis ccurtisj

View GitHub Profile
@ccurtisj
ccurtisj / sidekiq.config
Last active January 27, 2024 14:07 — forked from ssaunier/sidekiq.config
Running Sidekiq on AWS Elastic Beanstalk (Put that file in `.ebextensions` folder)
# Sidekiq interaction and startup script
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh":
mode: "000755"
owner: root
group: root
@ccurtisj
ccurtisj / jquery.waituntilexists.js
Created September 8, 2016 15:04 — forked from PizzaBrandon/jquery.waituntilexists.js
Updated waitUntilExists plugin
;(function ($, window) {
var intervals = {};
var removeListener = function(selector) {
if (intervals[selector]) {
window.clearInterval(intervals[selector]);
intervals[selector] = null;
}
@ccurtisj
ccurtisj / gist:946ec092a7f9d11e2ff9
Created May 28, 2014 20:47
Retrieve a failed or scheduled job from sidekiq
jid = 'ff07b7f9897d2472e1a4536c'
score = Time.parse('2014-05-29 11:00:00').to_f
scheduled_job = Sidekiq::ScheduledSet.new.fetch(score, jid).first
failed_job = Sidekiq::Failures::FailureSet.new.fetch(score, jid).first
# blog post:
require 'formtastic/version'
# Formtastic sets default input types for ActiveRecord column types. This does
# the same for Mongoid field types.
module Mongoid::Document
FORMTASTIC_2_2 = Formtastic::VERSION[/\A2\.2\.\d\z/]
# Map Mongoid field types to either ActiveRecord column types (which
@ccurtisj
ccurtisj / Git Configs
Last active March 24, 2017 16:02
Git preferences
# Git preferences
git config push.default current
# Some useful git aliases
## Basics
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
@ccurtisj
ccurtisj / uniq_value_counts.rb
Last active December 14, 2015 09:38
Quick helper to get all unique values present for objects in a given array. Useful for debugging.
#
# Returns a hash of all unique values for a given field and the number of objects
# in the array which have that value.
# ex:
# Post.all.uniq_value_counts(:status)
# => {
# "published" => 10,
# "draft" => 13,
# "archived" => 34
# }
LOCAL_MARKET_DISTRIBUTION = [
[4.5, 5.0],
[6, 4.5],
[8, 4.0],
[10.5, 3.5],
[13, 3.0],
[16, 2.5],
[21, 2.0],
[17, 1.5],
[4, 1.0],
@ccurtisj
ccurtisj / acceptance.rake
Created October 9, 2012 13:36
Acceptance spec rake task
if defined?(RSpec)
namespace :spec do
desc 'Run the acceptance specs in spec/acceptance'
task :acceptance => :environment do
exec 'rspec spec --tag acceptance'
end
end
end
@ccurtisj
ccurtisj / gist:2932908
Created June 14, 2012 20:56
Format meeeeeee
<html><body style=\"width: 653px; font-family: Arial; font-size: 12px; background-color: #cccccc;\" bgcolor=\"#cccccc\">\n \n \n <OpenTracking />\n \n <table style=\"font-family: Arial; width: 653px; background-color: #ffffff; border: 1px solid #999;\" bgcolor=\"#ffffff\">\n <tr>\n <td style=\"width: 653px;\">\n <a href=\"http://www.dealradar.com/deals/chicago?src=email&utm_source=custom_digest&utm_medium=email&utm_term=header&utm_campaign=chicago\" style=\"color: #027986; text-decoration: none;\"><img alt=\"\" src=\"http://s3.amazonaws.com/dealradar_assets/email_assets/email_header.png\" style=\"border: none;\" border=\"0\" /></a>\n <h1 style=\"margin-top: 15px; margin-left: 20px; margin-bottom: 0px; font-size: 15px; font-family: Arial; color: #027986;\">Local Deals in Chicago - Thursday June 14, 2012</h1>\n <p style=\"font-family: Arial; margin-top: 5px; padding-top: 0px; font-size: 12px; margin-left: 20px; padding-bottom: