Skip to content

Instantly share code, notes, and snippets.

View robbyrussell's full-sized avatar
:bowtie:
Focusing on @planetargon at the moment

Robby Russell robbyrussell

:bowtie:
Focusing on @planetargon at the moment
View GitHub Profile
@robbyrussell
robbyrussell / SaveYourselfFromSarahPalin.js
Created October 2, 2008 03:20
greasemonkey script to protect you from palin videos on youtube
// ==UserScript==
// @name SaveYourselfFromPalin
// @namespace http://www.youtube.com/
// @description saves you from the emotion that you feel after seeing another sarah palin clip
// @include http://www.youtube.com/*
// ==/UserScript==
var sarah = /(palin)/;
function pitbull_exists(lipstick) {
soap4r stuff
# before (this didn't really seem to work...)
soap.options["receive_timeout"] = 300
soap.options["connect_timeout"] = 300
# found examples with this online...
soap.options["protocol.http.connect_timeout"] = 300
@robbyrussell
robbyrussell / gist:15458
Created October 8, 2008 06:40
example of building line graph with ProtoChart
// line 1, requires an array of arrays (x,y)
var line_1 = [ [2000, 10000],
[2001, 13000],
[2002, 11245],
[2003, 11094],
[2003.4, 14392], // example with a dcimal in between a tick
[2004, 11000],
[2005, 10040],
[2006, 13590],
@robbyrussell
robbyrussell / skitchembedder.user.js
Created October 24, 2008 05:12
Replaces the select to copy html to not include the 'uploaded with plasq's skitch' references. makes LOLBugz less noisey
// ==UserScript==
// @name SkitchEmbedder
// @namespace skitch
// @description Robby Russell's hack to remove skitch crap from the embed HTML
// @include http://skitch.com/*
// ==/UserScript==
// clear out the sidebar
sidebar = document.getElementById( 'selectcopycontainer_3_div' );
sidebar.innerHTML = '';
@robbyrussell
robbyrussell / basecamp_favicons.user.js
Created November 10, 2008 20:19
A few gresemonkey scripts to add favicons to 37signals apps
// ==UserScript==
// @name Basecamp Favicons
// @namespace http://robbyonrails.com/greasemonkey
// @description Adds a favicon to Basecamp
// @include http://*.projectpath.com/*
// @include http://*.updatelog.com/*
// @include http://*.clientsection.com/*
// @include http://*.seework.com/*
// @include http://*.grouphub.com/*
// @include https://planetargon.grouphub.com/*
#!/bin/sh
#
# bash script to run a git-pull... and restart mongrel for you...
#
function mongrel_reload {
mongrel_rails stop;
mongrel_rails start -d;
}
@robbyrussell
robbyrussell / nightly-task.rb
Created November 24, 2008 05:46
a nightly task that could use some refactoring
#!/usr/bin/env ruby
sleep( 28800 )
<ul class="horizontal main_nav">
<li <%= 'class="active"' if current_page?( root_path ) -%>><%= link_to_unless_current( 'Plans', root_path, { :title => 'Boxcar Plans' } ) -%></li>
<li <%= 'class="active"' if current_page?( contact_path ) -%>><%= link_to_unless_current( 'Contact Us', contact_path, { :title => 'Contact Us' } ) -%></li>
<li <%= 'class="active"' if current_page?( support_path ) -%>><%= link_to_unless_current( 'Get Support', support_path, { :title => 'Get Support' } ) -%></li>
</ul>
def auto_complete_for_search_query
if params.has_key( :search_query ) and not params[:search_query].blank?
search_query = "%#{params[:search_query]}%"
@cars = Car.find( :all, :conditions => [ 'title LIKE ?', search_query ] )
render :partial => "search_results"
end
end
def search_query
auto_complete_for_search_query
@robbyrussell
robbyrussell / subdomain_accounts.rb
Created January 11, 2009 22:40
handle subdomain-based accounts with rails
#
# Inspired by
# http://dev.rubyonrails.org/svn/rails/plugins/account_location/lib/account_location.rb
#
module SubdomainAccounts
def self.included( controller )
controller.helper_method(:account_domain, :account_subdomain, :account_url, :current_account, :default_account_subdomain, :default_account_url)
end
protected