Skip to content

Instantly share code, notes, and snippets.

@melborne
Last active August 29, 2015 14:02
Show Gist options
  • 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