This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Earthquake.init do | |
command :size do |m| | |
p m[1].size | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# earthquake.gem plugin | |
# shorten url using bit.ly if text is over 140 | |
Earthquake.init do | |
config[:bitly] ||= {} | |
config[:bitly][:username] ||= 'earthquakegem' | |
config[:bitly][:api_key] ||= 'R_22e702353baf49751d053660e4c71a30' | |
config[:bitly][:domain] ||= 'j.mp' | |
input_filter do |text| | |
if /^:(update|reply|retweet|message)\s+/ === text and text.size - $&.size > 140 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://d.hatena.ne.jp/sugyan/20120219/1329623605 | |
Earthquake.init do | |
command :reduce_friends do | |
catch(:q) do | |
puts "YOU MAY LOSE YOUR ALL FRIENDS WHILE IDLING THE DAY AWAY".c(:notice) | |
until (friends = twitter.friends(page = (page ||= 0).next)).empty? | |
friends.shuffle.each do |friend| | |
name = friend["name"] | |
screen_name = friend["screen_name"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
# ### Customized colors for names and hashtags | |
# | |
# # See Earthquake.config[:color] for available color names. | |
# # Only which looks like a color name is the name of the color :). | |
# | |
# ⚡ :eval config[:color] | |
# | |
# # Colors also can be specified by a single number. | |
# # Using colors for background (ex. 44) will not work well on search results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/earthquake.rb b/lib/earthquake.rb | |
index be11649..328df67 100644 | |
--- a/lib/earthquake.rb | |
+++ b/lib/earthquake.rb | |
@@ -27,4 +27,5 @@ Encoding.default_external = Encoding.find('UTF-8') | |
help | |
commands | |
id_var | |
+ item | |
).each { |name| require_dependency File.expand_path("../earthquake/#{name}", __FILE__) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/earthquake/commands.rb b/lib/earthquake/commands.rb | |
index 755e600..13748fe 100644 | |
--- a/lib/earthquake/commands.rb | |
+++ b/lib/earthquake/commands.rb | |
@@ -343,7 +343,7 @@ Earthquake.init do | |
command :sent_messages do | |
puts_items twitter.sent_messages.each { |s| | |
- s["user"] = {"screen_name" => s["sender_screen_name"]} | |
+ s["user"] = {"screen_name" => s["recipient_screen_name"]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
Earthquake.once do | |
module TwitterOAuth | |
class Client | |
def list_statuses(user, list, **options) | |
options = URI.encode_www_form(options) | |
get("/lists/statuses.json?slug=#{list}&owner_screen_name=#{user}&#{options}") | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "eventmachine" | |
EventMachine.run do | |
Thread.new do | |
begin | |
system("cat") | |
rescue Exception => e | |
p e | |
ensure | |
EventMachine.stop_event_loop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/earthquake/commands.rb b/lib/earthquake/commands.rb | |
index 6551bfc..033578b 100644 | |
--- a/lib/earthquake/commands.rb | |
+++ b/lib/earthquake/commands.rb | |
@@ -232,12 +232,14 @@ Earthquake.init do | |
} | |
command %r!^:filter off$!, as: :filter do | |
+ highlights.delete(:filter_keyword) | |
config[:api] = default_stream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# monkey patch to support Twitter API v1.1 | |
Earthquake.once do | |
Module.new do |api_v1_1| | |
def trends(woeid) | |
get("/trends/place.json?id=#{woeid}") | |
end | |
TwitterOAuth::Client.__send__(:prepend, api_v1_1) | |
end |