Skip to content

Instantly share code, notes, and snippets.

View ttscoff's full-sized avatar

Brett Terpstra ttscoff

View GitHub Profile
View CSS skeleton generator
#!/usr/bin/env ruby
# Create an indented, structured CSS skeleton from valid XHTML markup
require 'rubygems'
require 'hpricot'
input =
def recurse_el(el,indent,parentEl)
View SurfSaver.applescript
#!/usr/bin/env osascript
-- For more info, see
-- Surf Saver 1.0
-- Saves tabs from Safari window to a dated page in VoodooPad, with a timestamp for the link group.
-- format of output is templatable below, defaults to markdown list.
-- Script by Brett Terpstra
-- built off of the amazing Scratchpad scripts by Ian Beck
View Songza Lucky Link TextMate Command
View Songza Link Selection (TextMate Command)
View service
#!/usr/bin/env ruby -rjcode -Ku
# From a TextMate command, but without TextMate-specific environment variables.
# Still works in TextMate, but makes a good Snow Leopard service as well.
# requires that MultiMarkdown be installed in ~/Library/Application Support/MultiMarkdown
# That, or edit the script to point to yours :)
input =
contents = ''
tags = ''
title = nil
View NerdTool RSS Script
#!/usr/bin/env ruby -rjcode -Ku
require 'rss/2.0'
require 'open-uri'
require 'time'
class RSSFetcher
RED = "\033[1;31m"
GREEN = "\033[32m"
YELLOW = "\033[33m"
View TextMate Drag Command for Base64-encoded images in CSS
# Drag command set to handle: jpg,png,gif
# scoped to: text.html.basic source.css.embedded.html, source.css
openssl base64 -in "$TM_DROPPED_FILE" | awk -v ext="${TM_DROPPED_FILE#*.}" '{ str1=str1 $0 }END{ print "background:url(data:image/"ext";base64,"str1");" }'
View tp2md.rb
#!/usr/bin/env ruby -rjcode -Ku
# TaskPaper to Markdown converter
# Usage: tp2md.rb filename.taskpaper >
require 'ftools'
infile = ARGV[0]
title = File.basename(infile,'.taskpaper').upcase
output = "# #{title} #\n\n"
prevlevel = 0
# This function performs app completion (open -a) based on known applications
# Originally by Kim Holburn
# Modified by Brett Terpstra because it wasn't working on 10.6.
# Added case insensitivity and LC_ALL='C' because unicode chars were breaking it.
# Then I went and modified the completion command
# even though I have little idea what I'm doing.
# also add 'o' to complete because I alias o to "open -a"
ttscoff / Quix commands for domain navigation
Created February 9, 2011 01:46
Bookmarklets for moving up or skipping to top levels of a domain, in [Quix format](
View Quix commands for domain navigation
> See <> for more info on Quix syntax and usage
up javascript:(function(){window.location=document.location.href.replace(/\/$/,'').split('/').slice(0,-1).join('/')+"/";})(); Move up one level in the sites directory structure
top javascript:(function(){window.location=document.location.protocol+"//";})(); Jump to top level of the current site