Skip to content

Instantly share code, notes, and snippets.

View trotter's full-sized avatar

Trotter Cashion trotter

View GitHub Profile
@trotter
trotter / .gitconfig
Created August 5, 2008 14:00
my .gitconfig
[user]
name = Trotter Cashion
email = cashion@gmail.com
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
@trotter
trotter / .profile
Created August 5, 2008 14:17
my .profile
source ~/Source/git-1.5.6.2/contrib/completion/git-completion.bash
export PATH=~/bin:~/Projects/utility-scripts:/usr/local/bin:/usr/local/sbin:$PATH:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:~/Projects/jruby-1.1RC3/bin:~/Source/MzScheme\ v352/bin:$EC2_HOME/bin
export PROJECTS=~/Projects
export CMS=$PROJECTS/motionbox/git/cms
export MB_FACEBOOK=$PROJECTS/motionbox/mb_facebook
export FLEX=$PROJECTS/motionbox/flex
export FLEX_HOME=~/Source/flex_sdk_3
export BRANCHES=$CMS/../branches/trotter
export FOLDERS=$BRANCHES/folders
# * <tt>:case_sensitive</tt> - Looks for an exact match. Ignored by non-text columns (+false+ by default).
# * <tt>:allow_nil</tt> - If set to true, skips this validation if the attribute is +nil+ (default is +false+).
# * <tt>:allow_blank</tt> - If set to true, skips this validation if the attribute is blank (default is +false+).
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine if the validation should
# occur (e.g. <tt>:if => :allow_validation</tt>, or <tt>:if => Proc.new { |user| user.signup_step > 2 }</tt>). The
# method, proc or string should return or evaluate to a true or false value.
# * <tt>:unless</tt> - Specifies a method, proc or string to call to determine if the validation should
# not occur (e.g. <tt>:unless => :skip_validation</tt>, or <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>). The
# method, proc or string should return or evaluate to a true or false value.
def validat
@trotter
trotter / Rename all but partials
Created August 25, 2008 12:19
Rename all but the partials
for file in $(find app/views -name *.haml); do ruby -e "new_file = ARGV[0].sub('.haml', '.html.haml'); unless ARGV[0] =~ %r[/_]; %x[git mv #{ARGV[0]} #{new_file}]; end" $file; done
# Setup ssh-agent
SSH_ENV=$HOME/.ssh/environment
# SSH Agent forwarding code taken from
# http://scie.nti.st/2007/10/12/minimal-footprint-ssh-agent-forwarding-on-os-x
function start_agent {
echo "Initializing new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
echo succeeded
chmod 600 ${SSH_ENV}
CmdUtils.CreateCommand({
name: "mbox-login",
homepage: "http://www.motionbox.com",
author: {name: "Trotter Cashion", email: "trotter.cashion@motionbox.com"},
license: "MIT",
description: "Quick and easy login to motionbox",
help: "Will log you into Motionbox and open a new tab with your profile page",
takes: {login: noun_arb_text},
modifiers: {"/": noun_arb_text, host: noun_arb_text},
module Spec
module Mocks
module ArgumentMatchers
class ArrayIncludingMatcher
# We'll allow an array of arguments to be passed in, so that you can do
# things like obj.should_receive(:blah).with(array_including('a', 'b'))
def initialize(*expected)
@expected = expected
end
require 'rubygems'
require 'fastercsv'
require 'ruby-debug'
data = FasterCSV.read(ARGV[0], :headers => :first_row)
columns = %w( PCI5 PCI6 PCI7 PCI9 PCI11 PCI13
PCI15 PCI21 PCI24
)
headers_extra = columns.map { |col| "p_#{col}" }
{"status": "available", "uploadedAt": "2009-06-02T22:35:33Z", "title": "Butterfly copy.wmv", "uid": "7a9ed2bb1e1ae1c4f5", "formats": {"thumbnail": {"encodingProgress": 0, "status": "encoding", "format": "thumbnail", "playerUrl": null, "estimatedEncodingTime": 2.8, "embedCode": null, "streamingUrl": null, "downloadUrl": "http://www.motionbox.com/thumbnails/2/8/0/4/90201097-2804699ad9eaf582-thumb.sic/thumb00000.jpg", "height": null, "progressiveUrl": "http://www.motionbox.com/thumbnails/2/8/0/4/90201097-2804699ad9eaf582-thumb.sic/thumb00000.jpg", "duration": 0, "width": null}, "poster": {"encodingProgress": 0, "status": "encoding", "format": "poster", "playerUrl": null, "estimatedEncodingTime": 2.8, "embedCode": null, "streamingUrl": null, "downloadUrl": null, "height": null, "progressiveUrl": null, "duration": null, "width": null}, "flv": {"encodingProgress": 0, "status": "encoding", "format": "flv", "playerUrl": "http://www.motionbox.com/videos/7a9ed2bb1e1ae1c4f5?type=advanced", "estimatedEncodingTime": 10.8,
{"status": "available", "uploadedAt": "2009-06-02T22:38:50Z", "title": "Bear copy.wmv", "uid": "7a9ed2bb1e1beecaf5", "formats": {"thumbnail": {"encodingProgress": 0, "status": "encoding", "format": "thumbnail", "playerUrl": null, "estimatedEncodingTime": 4.2, "embedCode": null, "streamingUrl": null, "downloadUrl": "http://www.motionbox.com/thumbnails/d/1/3/a/90201537-d13a3099581d94d5-thumb.sic/thumb00000.jpg", "height": null, "progressiveUrl": "http://www.motionbox.com/thumbnails/d/1/3/a/90201537-d13a3099581d94d5-thumb.sic/thumb00000.jpg", "duration": 0, "width": null}, "poster": {"encodingProgress": 0, "status": "encoding", "format": "poster", "playerUrl": null, "estimatedEncodingTime": 4.2, "embedCode": null, "streamingUrl": null, "downloadUrl": null, "height": null, "progressiveUrl": null, "duration": null, "width": null}, "flv": {"encodingProgress": 0, "status": "encoding", "format": "flv", "playerUrl": "http://www.motionbox.com/videos/7a9ed2bb1e1beecaf5?type=advanced", "estimatedEncodingTime": 16.2, "emb