Skip to content

Instantly share code, notes, and snippets.

@morygonzalez
Forked from DOGEME/ogyohee.rb
Created January 14, 2012 13:02
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 morygonzalez/1611350 to your computer and use it in GitHub Desktop.
Save morygonzalez/1611350 to your computer and use it in GitHub Desktop.
オギョヒーっていう時用 / earthquake.gem plugin
# -*- coding: utf-8 -*-
# ogyohee tweet / earthquake plugin
#
# ogyohee: http://shindanmaker.com/152454
#
require 'net/http'
Earthquake.init do
command %r|^:ogyo\s*(.+)*|, :as => :ogyohee do |m|
url = "http://shindanmaker.com/152454"
c = m[1].nil? ? rand(Time.now.to_i) : m[1]
html = Net::HTTP.post_form(URI.parse(url), { :u => c })
r = nil
html.body.split("\n").detect{|e| r = e.match(/>\s+?(.+)#{url}/)}
input(r[1]) if r
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment