Skip to content

Instantly share code, notes, and snippets.

View mikedamage's full-sized avatar

Mike Green mikedamage

View GitHub Profile
// Add an Adobe Acrobat icon to links that lead to PDF files
// the $= means "match if the string ends with this"
$('a[href$=".pdf"]').addClass("pdf_link");
$('a[href^="http://"]').addClass("external").attr('target', '_blank');
@mikedamage
mikedamage / start_time_machine.sh
Created February 4, 2009 16:12
Command to start a Time Machine backup and redirect STDOUT to /dev/null
/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper > /dev/null 2>&1 &
#include <stdio.h>
#include <stdlib.h>
int addFunction( int a, int b ) {
return a + b;
}
int stringLength( char *str ) {
return strlen(str);
}
-- read clipboard contents
set x to the clipboard
-- write to clipboard
set the clipboard to "some text"
-- restore previous contents
set the clipboard to x
@mikedamage
mikedamage / quicksilver_get_gist_action.scpt
Created February 5, 2009 17:14
Quicksilver action that retrieves a Gist by ID and copies it to the clipboard
(*
Get Github Gist
Quicksilver Action
by Mike Green
Created on 2009-02-05
*)
set githubUser to do shell script "/usr/local/bin/git config --global github.user"
set githubToken to do shell script "/usr/local/bin/git config --global github.token"
@mikedamage
mikedamage / gist-copy.cmd.js
Created February 7, 2009 04:19
Get a Gist by ID and copy to clipboard.
// Get & copy a Gist by ID
CmdUtils.CreateCommand({
name: "gist-copy",
icon: "http://gist.github.com/favicon.ico",
author: {name: "Mike Green", email: "mike.is.green@gmail.com"},
takes: {"gist": noun_arb_text},
preview: function(pblock, theGist) {
var urlTemplate = "http://gist.github.com/${gist}.txt";
var gistURL = CmdUtils.renderTemplate(urlTemplate, {gist: theGist.text});
CmdUtils.previewGet(pblock, gistURL, {}, function(data) {