Skip to content

Instantly share code, notes, and snippets.

@aaronpearce
Created June 28, 2013 05:47
Show Gist options
  • Save aaronpearce/5882713 to your computer and use it in GitHub Desktop.
Save aaronpearce/5882713 to your computer and use it in GitHub Desktop.
Just a small script to help me convert between base10 and base36 as needed
#!/usr/bin/env ruby
toValue = ARGV[0].to_i
idValue = ARGV[1]
if(!toValue || !idValue)
puts "You must supply your base-N number, either 10 or 36 and the value to be converted!\nExample: baseChange 36 2410189243882429"
else
if(toValue === 10)
puts idValue.to_i(36)
else
puts idValue.to_i.to_s(36)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment