Last active
June 7, 2021 17:11
-
-
Save KINGSABRI/23ce8d9ba45d80939ec0dba9b3c52c1e to your computer and use it in GitHub Desktop.
Ruby script to flip text upside down, reverse text and opposite
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
#!/usr/bin/ruby | |
# KING SABRI | @KINGSABRI | |
# Flipp, Upsite down text | |
subs = { | |
" " => " ", | |
"a" => "ɐ", | |
"b" => "q", | |
"c" => "ɔ", | |
"d" => "p", | |
"e" => "ǝ", | |
"f" => "ɟ", | |
"g" => "ƃ", | |
"h" => "ɥ", | |
"i" => "ı", | |
"j" => "ɾ", | |
"k" => "ʞ", | |
"l" => "l", | |
"m" => "ɯ", | |
"n" => "u", | |
"o" => "o", | |
"p" => "d", | |
"q" => "b", | |
"r" => "ɹ", | |
"s" => "s", | |
"t" => "ʇ", | |
"u" => "n", | |
"v" => "ʌ", | |
"w" => "ʍ", | |
"x" => "x", | |
"y" => "ʎ", | |
"z" => "z", | |
"A" => "∀", | |
"B" => "q", | |
"C" => "Ɔ", | |
"D" => "p", | |
"E" => "Ǝ", | |
"F" => "Ⅎ", | |
"G" => "פ", | |
"H" => "H", | |
"I" => "I", | |
"J" => "ſ", | |
"K" => "ʞ", | |
"L" => "˥", | |
"M" => "W", | |
"N" => "N", | |
"O" => "O", | |
"P" => "Ԁ", | |
"Q" => "Q", | |
"R" => "ɹ", | |
"S" => "S", | |
"T" => "┴", | |
"U" => "∩", | |
"V" => "Λ", | |
"W" => "M", | |
"X" => "X", | |
"Y" => "⅄", | |
"Z" => "Z", | |
"," => "'", | |
"!" => "¡", | |
"?" => "¿", | |
"(" => ")", | |
")" => "(", | |
"[" => "]", | |
"]" => "[", | |
"/" => "\\", | |
"." => "˙", | |
'"' => ",,", | |
"'" => "," | |
} | |
result = ARGV[0].split(//).reverse.map do |c| | |
subs[c].nil? ? subs.invert[c] : subs[c] | |
end.join("") | |
puts result |
Hi Mustafa
You have to have a string in your command argument
E.g.
ruby flippy.rb Mustafa
result
❯ ruby flippy.rb Mustafa
ɐɟɐʇsnW
ThankYou!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
<main>': undefined method
split' for nil:NilClass (NoMethodError)