Skip to content

Instantly share code, notes, and snippets.

View gfontenot's full-sized avatar
football

Gordon Fontenot gfontenot

football
View GitHub Profile
@gfontenot
gfontenot / gist:944618
Created April 27, 2011 16:35
Pretty good Bookmarklet for TweetBot on iOS
javascript:window.location='tweetbot:///post?text='+encodeURIComponent(document.title)+'%20-%20'+encodeURIComponent(window.location)
@gfontenot
gfontenot / gist:1022906
Created June 13, 2011 14:51
Twitter.app (Mac) bookmarklet
// Save this line of javascript as a bookmarklet. Will strip out utm_* nonsense
javascript:window.location='twitter://post?message='+encodeURIComponent(document.title+':%20'+window.location.href.replace(/\?utm_.*/i, ''))
@gfontenot
gfontenot / oopsiefocus.scpt
Created June 28, 2011 14:16
Modified version of Shawn Blanc's OopsieFocus script
(*
OopsieFocus
A script to launch OmniFocus and activate the Quick Entry Panel
By Shawn Blanc (http://shawnblanc.net)
May 20, 2011
With code used from the Toggle Twitter script by Red Sweater Software:
http://www.red-sweater.com/blog/1646/toggle-twitter
@gfontenot
gfontenot / change_deaktop.rb
Created July 7, 2011 18:02
Ruby script to change the desktop to a new image on Mac OSX
#!/usr/bin/env ruby
def change_desktop image_path
`osascript <<EOD
tell application "Finder"
set theFile to POSIX file "#{image_path}"
set desktop picture to theFile
end tell
EOD
@gfontenot
gfontenot / New Line From Anywhere.scpt
Created September 2, 2011 21:16
Copy TextMate's command + return behavior in BBEdit
tell application "BBEdit"
tell window 1
select insertion point after line (startLine of selection)
set selection to return
select insertion point before line ((startLine of selection) + 1)
end tell
end tell
@gfontenot
gfontenot / gist:1203520
Created September 8, 2011 14:25
Get duration of a video file with Ruby and FFMpeg
def get_movie_duration video_file
# Run ffmpeg on the video, and do it silently
ffmpeg_output = `/usr/local/bin/ffmpeg -i "#{video_file}" 2>&1`
# Find the duration in the output, and force a return if it's found
/duration: ([0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{2})/i.match(ffmpeg_output) { |m| return m[1] }
# If it didn't get a match, something is wrong. Log the error
return "FFMPEG ERROR"
@gfontenot
gfontenot / Create OF Tasks.applescript
Created October 12, 2011 16:38
Send selected lines in BBEdit to OmniFocus
tell application "BBEdit"
set _sel to the selection
set _lines to lines in selection
set tasks_added to {}
repeat with _line in _lines
if length of _line is not 0 then
my makeOFTask(_line as text)
set end of tasks_added to _line as text
end if
end repeat
@gfontenot
gfontenot / maruku-markdown.rb
Created December 21, 2011 22:32
Simple markdown converter for Maruku (Used with Marked)
#!/usr/bin/env ruby
require 'rubygems'
require 'maruku'
def markdown(text)
html = Maruku.new(text).to_html_document
end
puts markdown(ARGF.read)
@gfontenot
gfontenot / Marked.sublime-build
Created January 17, 2012 20:07
Marked build system for Sublime Text 2
{
"cmd": ["open","-a","/Applications/Marked.app","$file"],
"selector": "text.html.markdown"
}
@gfontenot
gfontenot / caveatPatchor.js
Created April 30, 2012 21:14
Propane hack to expand spotify artist and album urls to embedded players.
// Display Spotify songs inline
if (displaySpotifySongs) {
Campfire.SpotifyExpander = Class.create({
initialize: function(chat) {
this.chat = chat;
var messages = this.chat.transcript.messages;
for (var i = 0; i < messages.length; i++) {
this.detectSpotifyURL(messages[i]);