Last active
August 29, 2015 14:22
-
-
Save photomattmills/5f7c88cbc0315d642f0b to your computer and use it in GitHub Desktop.
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
auspost = { #table containing all the alphanumeric codes for auspost barcodes | |
"222" => "0", | |
"300" => "1", | |
"301" => "2", | |
"302" => "3", | |
"310" => "4", | |
"311" => "5", | |
"312" => "6", | |
"320" => "7", | |
"321" => "8", | |
"322" => "9", | |
"000" => "A", | |
"001" => "B", | |
"002" => "C", | |
"003" => " ", | |
"010" => "D", | |
"011" => "E", | |
"012" => "F", | |
"020" => "G", | |
"021" => "H", | |
"022" => "I", | |
"100" => "J", | |
"101" => "K", | |
"102" => "L", | |
"110" => "M", | |
"111" => "N", | |
"112" => "O", | |
"120" => "P", | |
"121" => "Q", | |
"122" => "R", | |
"200" => "S", | |
"201" => "T", | |
"202" => "U", | |
"210" => "V", | |
"211" => "W", | |
"212" => "X", | |
"220" => "Y", | |
"221" => "Z", | |
"023" => "a", | |
"030" => "b", | |
"031" => "c", | |
"032" => "d", | |
"033" => "e", | |
"103" => "f", | |
"113" => "g", | |
"123" => "h", | |
"130" => "i", | |
"131" => "j", | |
"132" => "k", | |
"133" => "l", | |
"203" => "m", | |
"213" => "n", | |
"223" => "o", | |
"230" => "p", | |
"231" => "q", | |
"232" => "r", | |
"233" => "s", | |
"303" => "t", | |
"313" => "u", | |
"323" => "v", | |
"330" => "w", | |
"331" => "x", | |
"332" => "y", | |
"333" => "z" | |
} | |
flipped_numbers = {"1" => "2", "2" => "1", "3" => "3", "0"=>"0", " " => " " } | |
site_codes = {"0" => "F", "1" => "A", "2" => "D", "3" => "S" } | |
# alexis' bar code: | |
code = "223 100 121 033 032 233 310 221 320 001 012 221 202 323 012 032 122 001 010" | |
# this one is from a tweet of one of the others to receive the envelope: | |
code_2 = "202 200 121 311 032 100 200 310 031 001 012 221 202 332 012 032 122 001 010" | |
puts code.split(" ").map{|c| auspost[c] }.join("") # => oJQeds4Z7BFZUvFdRBD | |
puts code_2.split(" ").map{|c| auspost[c] }.join("") # => USQ5dJS4cBFZUyFdRBD | |
# Neither result makes much sense to me. Neither is a valid Auspost code, as far as | |
# I can tell; they begin and end the wrong way. Someone smarter than me should take a crack. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment