Created
October 6, 2008 22:55
-
-
Save newtonapple/15168 to your computer and use it in GitHub Desktop.
Flip Mode
This file contains 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
module Flip; $KCODE = "u" | |
FLIP_MAP = Hash.new{|h,k| k} | |
{ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghiklmnopqrstuvwxyz' => | |
'∀ᗺↃᗡƎℲ⅁HIᒋʞ⅂ƜNOdԾᖈS⊥ႶΛMX⅄Zɐqɔpǝɟɓɥᴉʞ│ɯuodbɹsʇnʌʍxʎz', | |
'123456890~!@$%^&*()_+{}:|<>?"#`[],./-=\\' => | |
'|ᘔᗴhᔕ9860~¡Ꭷ$%⋁⅋*)(‾+}{:|><¿„#ˎ][‘˙/-=\\' | |
}.each {|from,to| from.split(//).zip(to.split(//)).each {|f,t| FLIP_MAP[f]=t }} | |
FLIP_MAP.merge!("'"=>',', '7'=>'/̲', 'j'=>'⌠̣', ';'=>':́') | |
def flip | |
FLIP_MAP.values_at(* split(//)).join | |
end | |
end | |
class String | |
include Flip | |
end | |
':)'.flip # ":(" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment