Skip to content

Instantly share code, notes, and snippets.

View tjh's full-sized avatar

Tim Harvey tjh

View GitHub Profile

Motivation

We recently were working on a project where the version of Firefox on the development machines was causing acceptance tests running on Capybara and Selenium to fail and/or hang erroneously. The solution was to point Selenium at a custom version of Firefox. We also added the Firefox binaries to the application git repo so that all devs could run against a known good version of Firefox.

Solution

  1. Download the desired version of Firefox from ftp://ftp.mozilla.org/pub/firefox/releases/

  2. Put Firefox.app in your rails app somewhere like ./bin/spec/macosx/

@tjh
tjh / gist:1725383
Created February 2, 2012 19:52 — forked from netshade/gist:1725305
Track Nginx Proc Count
while :; do (ps -o command -U YOUR_APP_USER | awk "/Rack:/ {print $1 $2}" | wc -l | { read procs; echo "hello version 1.0\nauthenticate YOUR_API_KEY\ngauge nginx.proc.num $procs `date +%s`\n" } ) | nc instrumentalapp.com 8000; sleep 60; done
Order.class_eval do
def has_site_approvals?
line_items.each do |item|
return true if item.approval && item.approval.approved?
end
false
end
end
Approval.class_eval do
class Tweet < ActiveRecord::Base
def self.latest_text
if Tweet.first.nil? || Tweet.first.created_at < ENV['CACHE_TIMEOUT'].to_i.minute.ago
begin
httpauth = Twitter::HTTPAuth.new(ENV['TWITTER_USR'], ENV['TWITTER_PWD'])
client = Twitter::Base.new(httpauth)
Tweet.delete_all
client.user_timeline.each do |tweet|
- f.fields_for :user_achievements do |child_form|
- if child_form.object.user == @user #This is stupid and dangerous
= blah blah blah
@tjh
tjh / .irbrc
Created December 22, 2009 14:10 — forked from unixmonkey/.irbrc
# *****************************************
# .irbrc
#
# Tim Harvey - Literacy5
# http://literacy5.com/
#
# Includes tons of visual sugar, based on the
# work of:
#
# UnixMonkey - http://gist.github.com/254551
@tjh
tjh / bodyid.rb
Created October 14, 2009 13:40 — forked from timnovinger/bodyid.rb
###############################################
# place in /app/helpers/application_helper.rb #
###############################################
def bodytag_id
a = controller.class.to_s.underscore.gsub(/_controller$/, '')
b = controller.action_name.underscore
"#{a}-#{b}".gsub(/_/, '-')
end