This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Create an indented, structured CSS skeleton from valid XHTML markup | |
require 'rubygems' | |
require 'hpricot' | |
input = STDIN.read | |
def recurse_el(el,indent,parentEl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env osascript | |
-- For more info, see http://brettterpstra.com | |
-- 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 | |
-- http://brettterpstra.com | |
-- built off of the amazing Scratchpad scripts by Ian Beck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* AppleScript that calls the python code buried in an automator action. This is example code for use with Devonthink Office Pro. The script should combine to PDF's into one new original *) | |
try | |
set myScript to "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -- Path to the python script | |
set sourceOne to "/Path/To/First/PDF/myFile.PDF" -- First PDF | |
set sourceTwo to "/Path/To/Second/PDF/myFile.PDF" -- Second PDF | |
set myDestination to "~/final.pdf" -- The new file | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 = STDIN.read | |
contents = '' | |
tags = '' | |
title = nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -rjcode -Ku | |
# TaskPaper to Markdown converter | |
# Usage: tp2md.rb filename.taskpaper > output.md | |
require 'ftools' | |
infile = ARGV[0] | |
title = File.basename(infile,'.taskpaper').upcase | |
output = "# #{title} #\n\n" | |
prevlevel = 0 | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This function performs app completion (open -a) based on known applications | |
# Originally by Kim Holburn http://www.holburn.net/ | |
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MacVim + latexmk + Skim workflow: | |
MacVim http://code.google.com/p/macvim/ | |
Latexmk http://www.phys.psu.edu/~collins/software/latexmk-jcc/ | |
Skim.app http://skim-app.sourceforge.net/ | |
Open the texfile in macvim: | |
$ mvim <file>.tex | |
Watch tex file with latexmk (see also ~/.dotfiles/latexmkrc): | |
$ latexmk -pdf -pvc <file>.tex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- starts listed applications | |
set theAppList to {"GrowlHelperApp", "LaunchBar", "Default Folder X Helper", "MercuryMoverAgent", "HardwareGrowler", "HazelHelper", "BetterTouchTool", "NetworkLocation", "LazyMouseBG", "SteerMouse Manager", "TextExpander", "Optimal Layout", "Dropbox"} as list | |
set theDelay to 15 | |
set appCount to count of theAppList | |
repeat with currentApp in theAppList | |
tell application "System Events" | |
set isGrowlRunning to ¬ | |
(count of (every process whose name is "GrowlHelperApp")) > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# Returns the best running editor (Mac), if any, based on my personal order of preference. | |
def pick_editor | |
editors = ['TextMate','MacVim','Espresso','Coda','TextEdit'] | |
ps = %x{ps Ao comm|grep .app|awk '{match($0,/([^\\/]+).app/); print substr($0,RSTART,RLENGTH)}'}.split("\n") | |
editors.each {|editor| | |
return editor if ps.include?(editor+".app") | |
} |
OlderNewer