Skip to content

Instantly share code, notes, and snippets.

@melborne
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melborne/31f81cc17084a0aea7d7 to your computer and use it in GitHub Desktop.
Save melborne/31f81cc17084a0aea7d7 to your computer and use it in GitHub Desktop.
# flip plugin
# ====
#
# You can post flip text or vertical text.
#
# Usage
# ----
#
# :flip twitter # => "ɹəʇʇᴉʍʇ"
#
# :flip -r twitter # => "ʇʍᴉʇʇəɹ"
#
# :flip -v FOO\\BAR++ by vertical # => "B F"
# "A O"
# "R O by vertical"
#
# See also:
# ----
#
# * https://github.com/melborne/flippy
require 'flippy'
Earthquake.init do
command /^:flip\s+\-(r|v)\s+(.+)$/, :as => :flip do |m|
subcommand, text = m.captures
case subcommand
when 'r'
status = text.flip.flip
when 'v'
status = text.gsub(/\\\\/, "\n")
.gsub(/ +/, "\n")
.vertical
end
async_e {twitter.update(status)} if confirm(status)
end
command :flip do |m|
status = m[1].flip
async_e {twitter.update(status)} if confirm(status)
end
end
# https://gist.github.com/melborne/31f81cc17084a0aea7d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment