Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Weston Triemstra thermistor

🏠
Working from home
Block or report user

Report or block thermistor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dewip.sh
alias dewip="sed -E -i '' -e '/^[[:blank:]]*@wip$/d;s/,[[:blank:]]*@wip//g;s/@wip,[[:blank:]]*//g' features/*.feature"
View Instrument Anything in Rails 3.md

Instrument Anything in Rails 3

With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)

Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
  Processing by HomeController#index as HTML
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
  CACHE (0.0ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
Rendered layouts/_nav.html.erb (363.4ms)
@thermistor
thermistor / assets.rake
Created Oct 20, 2011 — forked from shedd/assets.rake
Check asset encoding for valid UTF-8
View assets.rake
namespace :assets do
desc "Check that all assets have valid encoding"
task :check => :environment do
paths = ["app/assets", "lib/assets", "vendor/assets"]
extensions = ["js", "coffee", "css", "scss"]
paths.each do |path|
dir_path = Rails.root + path
@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
You can’t perform that action at this time.