Skip to content

Instantly share code, notes, and snippets.

View kcdragon's full-sized avatar
🏠
Working from home

Mike Dalton kcdragon

🏠
Working from home
View GitHub Profile
### Keybase proof
I hereby claim:
* I am kcdragon on github.
* I am kcdragon (https://keybase.io/kcdragon) on keybase.
* I have a public key whose fingerprint is 9BCD 0964 3B79 0BAA 2A47 20DA C4E9 439D 4D72 483A
To claim this, I am signing this object:
@kcdragon
kcdragon / gist:a18a1d9af003c261ea62
Created August 31, 2014 23:36
During deploy:rollback, only rollback migration if the migration was created in the previous deploy
before :deploy do
# Get the topmost migration that has been run:
run "rake db:current_version > migration_version.txt"
end
after 'deploy:rollback' do
run "rake db:migrate VERSION=`cat migration_version.txt`"
end
after :deploy do
@kcdragon
kcdragon / gist:48a0b3edcd617b01b7c8
Created August 27, 2014 21:22
Send HipChat message if there are multiple Sidekiq processes running
namespace :sidekiq do
detect_duplicate_processes = ->(context, server) do
number_of_sidekiq_processes = context.capture('ps aux | grep "[s]idekiq" | wc -l').to_i
rails_env = context.fetch(:rails_env, nil)
hipchat_token = context.fetch(:hipchat_token, nil)
hipchat_room_name = context.fetch(:hipchat_room_name, nil)
client = HipChat::Client.new(hipchat_token, {})