Skip to content

Instantly share code, notes, and snippets.

View itspriddle's full-sized avatar
🤘
clickity clack

Joshua Priddle itspriddle

🤘
clickity clack
View GitHub Profile
# Run tests with `PROFILE_FG=1 [rake|rspec]` to profile FactoryGirl
#
# Example output:
#
# **Class** | **create** | **build** | **attributes_for**
# --------- | ---------- | --------- | ------------------
# **Total** | **11** | **0** | **0**
# Post | 5 | 0 | 0
# Author | 3 | 0 | 0
# User | 3 | 0 | 0
#!/usr/bin/env osascript
-- Copy a UUID to the clipboard
set the clipboard to do shell script "uuidgen | tr -d '\n'"
#!/usr/bin/ruby
# Tested on OS X Leopard only but should work
# for BSDs
start = /\{ sec = ([0-9]+),/.match(`sysctl -n kern.boottime`).captures[0]
uptime_secs = (Time.now.to_f - start.to_f).round
def seconds_to_time(seconds)
<?php
function parse_sdp($packet = '')
{
$out = array();
$lines = explode("\n", $packet);
foreach ($lines as $l)
{
$l = trim($l);
# Create a ~/.twitter/credentials.yml file.
# Example:
# name: twittername
# password: password
require 'rubygems'
require 'rest_client'
path = File.join(File.join(ENV['HOME'], ".twitter"), "credentials.yml")
user = YAML::load_file(path)
@itspriddle
itspriddle / gist:88109
Created March 31, 2009 08:49
~/.input.rc
# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# allow the use of the Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert
# allow ctrl/alt + arrow keys to work
"\e[5C": forward-word
@itspriddle
itspriddle / gist:91536
Created April 7, 2009 23:43
bash_completion
# bash_completion - programmable completion functions for bash 3.x
# (backwards compatible with bash 2.05b)
#
# $Id: bash_completion,v 1.872 2006/03/01 16:20:18 ianmacd Exp $
#
# Copyright (C) Ian Macdonald <ian@caliban.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
{
"\UF729" = "moveToBeginningOfLine:"; /* Home */
"\UF72B" = "moveToEndOfLine:"; /* End */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
}
/*
Add to ~/Library/KeyBindings/DefaultKeyBinding.dict
Create the directory if it does not exist
echo '.DS_Store' >> ./.gitignore
echo '*.swp' >> ./.gitignore
echo 'config/database.yml' >> ./.gitignore
echo 'config/mailer.yml' >> ./.gitignore
echo '*.sql' >> ./.gitignore
echo 'index/' >> ./.gitignore
echo 'public/system' >> ./.gitignore
echo 'public/tmp/' >> ./.gitignore
echo '[^.]*' > ./log/.gitignore
#!/bin/bash
usage() {
cat <<-EOT
usage: $0 [home|work]
This script starts a Synergy server for home or work.
EOT
}