Created
March 9, 2014 03:46
-
-
Save sorahn/9442634 to your computer and use it in GitHub Desktop.
Simple hex helpers.
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
# Parse ini style numbers in strings. | |
# hex = '$123ABC' | |
# dec = '123456' | |
String::getHex = -> parseInt @, 16 | |
String::iniHex = -> if "#{@.charAt 0}" is '$' then do "#{@.slice 1}".getHex else +@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment