Skip to content

Instantly share code, notes, and snippets.

@newtonapple
Created October 6, 2008 22:55
Show Gist options
  • Save newtonapple/15168 to your computer and use it in GitHub Desktop.
Save newtonapple/15168 to your computer and use it in GitHub Desktop.
Flip Mode
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