Skip to content

Instantly share code, notes, and snippets.

class ApplicationController
private
def newrelic_metric_path(action_name_override = nil)
format_string = case
when request.format.html?
'.html'
when request.format.json?
'.json'
when request.format.xml?
'.xml'
module Schema
def self.migrate
config.each do |(name, properties)|
migrate_column_family(name, properties)
end
wait_for_schema_agreement
schema
end
def self.schema_agreement?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang='en-en' xml:lang='en-en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
<title>Javascript Instant Search</title>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script>
<script src='http://drasticcode.com/demo/js_search/search.js' type='text/javascript'></script>
<script type='text/javascript'>
$().ready(function(){$('#q').focus()});// focus search area
</script>
[animation]
s0_open_effects = animation:Glide 2;animation:None;animation:None;
s0_open_durations = 80;80;131;
s0_open_matches = ((type=Normal | Unknown) | name=sun-awt-X11-XFramePeer | name=sun-awt-X11-XDialogPeer) & !(role=toolTipTip | role=qtooltip_label) & !(type=Normal & override_redirect=1) & !(name=gnome-screensaver);(type=Menu | PopupMenu | DropdownMenu | Dialog | ModalDialog | Normal);(type=Tooltip | Notification | Utility) & !(name=compiz) & !(title=notify-osd);
s0_open_options = ;;;
s0_open_random_effects =
s0_close_effects = animation:Fade;animation:Fade;animation:None;
s0_close_durations = 80;80;50;
s0_close_matches = ((type=Normal | Unknown) | name=sun-awt-X11-XFramePeer | name=sun-awt-X11-XDialogPeer) & !(role=toolTipTip | role=qtooltip_label) & !(type=Normal & override_redirect=1) & !(name=gnome-screensaver);(type=Menu | PopupMenu | DropdownMenu | Dialog | ModalDialog | Normal);(type=Tooltip | Notification | Utility) & !(name=compiz) & !(title=notify-osd) ;
s0_close_options = ;;;
@samg
samg / cat_scrape_data.sh
Created December 21, 2010 07:02
cat_scrape_data.sh cat_scrape_data.sh
#!/bin/bash
if [ -z "$1" ] ; then
echo "usage: $0 [scrape_id]"
exit 1
fi
if [ -z "$2" ] ; then
echo "usage: $0 [scrape_id] [output file]"
exit 1
@samg
samg / .irbrc
Created September 24, 2010 18:18
puts "loading #{$0}"
require 'pp'
require 'irb/completion'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
IRB.conf[:AUTO_INDENT]=true
# load console_with_helpers if possible
script_console_running = ENV.include?('RAILS_ENV') && IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers')
rails_running = ENV.include?('RAILS_ENV') && !(IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers'))
irb_standalone_running = !script_console_running && !rails_running
Backup
- wasn't necessary for me but do it.
- Super Duper - creates bootable backup
Disk Utility
- partition hard disk into two equal partions
Download Ubuntu
- 10 64bit
- Burn onto CD using Disk Utility
#!/bin/sh
bad_requests=0
while [ true ]; do
response=`curl -i --max-time 5 -s -u user:password http://ci.aboutus.com/XmlStatusReport.aspx`
if [ `echo $response | grep 'HTTP/1.1 200 OK' | wc -l` -ne 1 ] ; then
bad_requests=`expr $bad_requests + 1`
else
bad_requests=0
fi
set nocompatible
set scrolloff=2
set nowrap
set wildmenu
set iskeyword+=?,!
set backspace=2
set background=dark
filetype plugin indent on
syntax on
set ruler
[alias]
st = status
ci = commit
br = branch
co = checkout
df = diff
lg = log -p
l = log --graph --pretty=format:'%Cred%h%Creset - %Cblue%an%Creset - %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
la = log --graph --pretty=format:'%Cred%h%Creset - %Cblue%an%Creset - %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative --all
pr = pull --rebase