Skip to content

Instantly share code, notes, and snippets.

@yoshuki
Created July 9, 2011 15:52
Show Gist options
  • Save yoshuki/1073686 to your computer and use it in GitHub Desktop.
Save yoshuki/1073686 to your computer and use it in GitHub Desktop.
Works with SW Notifier(http://saikyoline.jp/air/swn/).
# encoding: utf-8
require 'socket'
module Kernel
def sw(*args)
args.each do |arg|
TCPSocket.open('localhost', 12345) {|s| s.write arg }
end
end
def sw_r(*args)
sw *(args.map {|a| "R:#{a}" })
end
def sw_y(*args)
sw *(args.map {|a| "Y:#{a}" })
end
def sw_g(*args)
sw *(args.map {|a| "G:#{a}" })
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment