Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Weston Triemstra thermistor

🏠
Working from home
View GitHub Profile
@thermistor
thermistor / delayed_job.rb
Created Nov 19, 2011
have failed jobs report via airbrake as well
View delayed_job.rb
# have failed jobs report via airbrake as well
# save it as config/initializers/delayed_job.rb
class Delayed::Worker
protected
def handle_failed_job_with_airbrake(job, error)
Airbrake.notify_or_ignore(error)
handle_failed_job_without_airbrake(job, error)
end
@thermistor
thermistor / deploy.rb
Created Jun 26, 2012 — forked from ryanb/deploy.rb
Check to see if you have changes in head which have not been pushed before deploying
View deploy.rb
namespace :deploy do
desc "Make sure there is something to deploy"
task :check_revision, :roles => :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
end
@thermistor
thermistor / chef_solo_bootstrap.sh
Last active Oct 6, 2015 — forked from wadtech/chef_solo_bootstrap.sh
Bootstrap Chef Solo for Ubuntu 12.04 LTS
View chef_solo_bootstrap.sh
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.bz2
tar -xvjf ruby-2.0.0-p195.tar.bz2
cd ruby-1.9.3-p327/
./configure --prefix=/usr/local
make
@thermistor
thermistor / gist:3107339
Created Jul 13, 2012 — forked from ericbeland/gist:846482
Slow Down webdriver in Capybara (Monkeypatch for 0.1.3)
View gist:3107339
# This is a total hack to slow down webdriver in Capybara
# so you can more easily watch what is happening.
# paste this above the top of a Capybara Webdriver RSpec test if you need to debug something in slo-mo
require 'selenium-webdriver'
module ::Selenium::WebDriver::Remote
class Bridge
def execute(*args)
View deploy.rb
set :user, 'application'
set :application, 'nayada'
set :deploy_to, "/#{user}/rails/#{application}-git"
ssh_options[:paranoid] = false
ssh_options[:port] = 389
role :app0, "94.127.68.83", :primary => true
namespace :deploy do
@thermistor
thermistor / index.html
Created Aug 17, 2012 — forked from anonymous/index.html
This is just an experiment! There are certainly better ways to show an image of a MacBook, but none as fun as this :)
View index.html
<i class="macbook"></i>
@thermistor
thermistor / OPTIONS.rb
Created Sep 18, 2012 — forked from ajturner/OPTIONS.rb
make Rails respond to an HTTP OPTIONS method request
View OPTIONS.rb
# Add to routes.rb
# Needed for responding to OPTIONS http method
map.connect '*path',
:controller => 'home',
:action => 'options_for_mopd',
:conditions => {:method => :options}
# in home_controller.rb
@thermistor
thermistor / kill_test_servers.sh
Created Nov 6, 2012 — forked from trodrigues/kill_test_servers.sh
kill script for phantom, buster, selenium
View kill_test_servers.sh
#!/bin/bash
# just call with ./kill_test_servers.sh buster-server|selenium|phantom
function get_buster_server_pid(){
echo `ps aux|grep buster-server|grep node|awk '{ print $2 }'`
}
function get_selenium_server_pid(){
echo `ps aux|grep selenium|grep java|awk '{ print $2 }'`
}
@thermistor
thermistor / gist:4064149
Created Nov 13, 2012 — forked from ebidel/gist:3723309
Spotlight bookmarklet
View gist:4064149
// Save this in a bookmarklet and click it on a page:
javascript:(function(){function d(a,c){document.body.style.webkitClipPath="circle("+a+"px, "+c+"px, "+b+"px)"}var b=90;window.addEventListener("mousemove",function(a){d(a.pageX,a.pageY)});window.addEventListener("mousewheel",function(a){if(a.shiftKey){a.preventDefault();var c=a.wheelDeltaY;b+=-c;b=0<c?Math.max(90,b):Math.min(b,window.innerHeight/2);d(a.pageX,a.pageY)}})})();
// Or paste this in the console and mouse over the page.
// SHIFT+mousewheel scroll makes the circle bigger/smaller.
(function() {
var radius = 90; // px
View makeapp.sh
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name=$inputline
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url=$inputline
You can’t perform that action at this time.