Skip to content

Instantly share code, notes, and snippets.

@babie
Last active December 26, 2015 12:59
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 babie/7155110 to your computer and use it in GitHub Desktop.
Save babie/7155110 to your computer and use it in GitHub Desktop.
module TwitterOAuth
class Client
def update_profile(params)
post("/account/update_profile.json", params)
end
end
end
Earthquake.init do
command :me do
input(%Q|:user #{twitter.info['screen_name']}|)
end
help :me, "show myself info"
%w[name description url location].each do |word|
command word.to_sym do |m|
text = _eval_as_ruby_string(m[1])
async_e { twitter.update_profile word.to_sym => text } if confirm("update #{word} '#{text}'")
end
if word == "description"
alias_command :bio, :description
command %r|^:#{word}$|, :as => word.to_sym do
puts "[input EOF (e.g. Ctrl+D) at the last]".c(:info)
system "stty icrnl brkint"
text = STDIN.gets(nil)
text = _eval_as_ruby_string(text)
if text && !text.split.empty?
async_e { twitter.update_profile word.to_sym => text } if confirm("update #{word} above AA?")
end
end
alias_command %r|^:bio$|, :description
help word.to_sym, "update #{word}", <<-HELP
⚡ :#{word} this is my new #{word}
⚡ :#{word}[ENTER]
^D
HELP
end
help word.to_sym, "update #{word}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment