Skip to content

Instantly share code, notes, and snippets.

View pdxmph's full-sized avatar

Mike Hall pdxmph

View GitHub Profile
@pdxmph
pdxmph / adium_away_for_10.rb
Created September 10, 2015 21:23
Set Adium away message to now + 10 minutes so I can go for a walk around the park.
#!/usr/bin/env ruby
require "rubygems"
require "appscript"
require "active_support/all"
include Appscript
adium = app("Adium")
time = Time.current + 10.minutes
back = time.strftime("%l:%M")
@pdxmph
pdxmph / garb_mobile_report.rb
Created June 16, 2011 21:43
Basic Mobile Report
#!/usr/bin/env ruby -W0
require "rubygems"
require "garb"
sd = Date.parse("2011-05-01")
ed = Date.parse("2011-05-30")
config = YAML.load(File.open('smt_config.yml'))
@pdxmph
pdxmph / gist:1084017
Created July 15, 2011 03:41
Newsletter Stylify Markup
#!/usr/bin/env ruby -wKU
require "rubygems"
require "nokogiri"
attribs = {
"h3" => "font-size: 16px; font-weight: bold; margin: 0 0 10px; padding: 0 14px;",
"p" => "margin: 0 0 8px; padding: 0 12px;",
"li" => "margin-top:8px;",
"ul" => "margin: 0 0 8px 1.5em; padding: 0 12px;"
}
@pdxmph
pdxmph / acorn_imgur_export.rb
Created July 16, 2011 22:38
Export Frontmost Acorn to PNG, Upload to imgur, Get URL back to clipboard
#!/usr/bin/env ruby
require "rubygems"
require "imgur"
require "appscript"
include Appscript
# get your imgur API key here: http://imgur.com/register/api
imgur_api = "xxxxxxxxxxxxxxxxx"
@pdxmph
pdxmph / dopen.rb
Created August 4, 2011 20:45
Easy way to open bunches of instances of the same path on multiple sites
#!/usr/bin/env ruby
# notes at the bottom
require "rubygems"
require "appscript"
require "yaml"
include Appscript
browser = app("Safari") # could be "Google Chrome" or "Firefox," too
@pdxmph
pdxmph / feed_combine.rb
Created August 10, 2011 17:10
Combine a pair of RSS feeds
#!/usr/bin/env ruby
require "rubygems"
require 'rss/1.0'
require 'rss/2.0'
require 'open-uri'
require 'rss/maker'
version = "2.0"
dest_dir = ""
@pdxmph
pdxmph / twitter_handle_cleanup.rb
Created September 13, 2011 16:56
Clean up twitter handles
#!/usr/bin/env ruby
require "rubygems"
require "active_record"
require "uri"
require "yaml"
config_file = File.open(File.expand_path('~') + "/etc/smt_config.yml")
config = YAML.load(config_file)
sites = config["sites"]
@pdxmph
pdxmph / gist:1251131
Created September 29, 2011 16:14
Update Google spreadsheet with bitly urls
#!/usr/bin/env ruby
require "rubygems"
require "roo"
require "ostruct"
require "bitly"
require "yaml"
@pdxmph
pdxmph / get_firefox_url.rb
Created November 6, 2011 06:42
Get current Firefox URL with rb-appscript
require "rubygems"
require "appscript"
include Appscript
firefox = app("Firefox")
events = app("System Events")
firefox.activate
events.keystroke("l", :using => [:command_down])
@pdxmph
pdxmph / add_nnw_to_safari_reading_list.rb
Created November 6, 2011 06:20
Add current NetNewsWire headline to Safari reading list
#!/usr/bin/env ruby -wKU
require "rubygems"
require "appscript"
include Appscript
nnw = app("NetNewsWire")
safari = app("Safari")
save_url = nnw.selectedHeadline.URL.get