Skip to content

Instantly share code, notes, and snippets.

View blotto's full-sized avatar

Nick Newell blotto

View GitHub Profile
@blotto
blotto / IronMQ example1
Last active August 29, 2015 14:05
IronMQ example
function postTerm(term) {
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
var data = {
"messages": [
{
"body": term
}
@blotto
blotto / gist:8005531b9c94f3732240
Last active August 29, 2015 14:02
Sample Unicorn.rb File
#see https://devcenter.heroku.com/articles/rails-unicorn#the-unicorn-server
worker_processes ENV['WEB_CONCURRENCY'].to_i > 0 ? ENV['WEB_CONCURRENCY'].to_i : 3
timeout ENV['REQUEST_TIMEOUT'].to_i > 0 ? ENV['REQUEST_TIMEOUT'].to_i : 15
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
@blotto
blotto / cleaners.rb
Created April 9, 2014 22:15
Some Sidekiq helper methods
module AsyncTools
module Cleaners
def self.find_job_for_object_by_method(klass, method)
jobs = Sidekiq::ScheduledSet.new
jobs.select { |job|
@blotto
blotto / deploy
Created January 27, 2014 19:37
CI Deploy to Heroku
#one off to ensure heroku remote is added to repo
heroku git:remote -a myApp
git remote add heroku [email protected]:myApp.git
#disables
curl https://heroku.newrelic.com/accounts/ACCTID/applications/APPID/ping_targets/disable -X POST -H "X-Api-Key: APIKEY"
heroku maintenance:on --app myApp
#push to heroku
git push --force heroku master
heroku run rake db:migrate --app myApp
#enables
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = '[email protected]'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }
@blotto
blotto / set_jenkins_permGen_heapSize
Created February 26, 2013 22:06
increase permGen heapSize for Jenkins on MacOSx
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
sudo touch /Library/Preferences/org.jenkins-ci
sudo defaults write /Library/Preferences/org.jenkins-ci permGen 512m
sudo defaults write /Library/Preferences/org.jenkins-ci heapSize 2048m
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist