Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created August 1, 2012 02:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jugyo/3222737 to your computer and use it in GitHub Desktop.
Save jugyo/3222737 to your computer and use it in GitHub Desktop.
earthquake plugin to notify via Notification Center on Mountain Lion
begin
require 'terminal-notifier'
module Earthquake
module Core
def notify_with_nc(message, options = {})
if matches = URI.extract(message, ["http", "https"])
options[:open] = matches[0]
end
notify_without_nc(message, options)
end
alias_method :notify_without_nc, :notify
alias_method :notify, :notify_with_nc
alias_method :n, :notify
end
end
rescue LoadError => e
puts 'You need terminal-notifier.gem'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment