Skip to content

Instantly share code, notes, and snippets.

@sorahn
Created March 9, 2014 03:46
Show Gist options
  • Save sorahn/9442634 to your computer and use it in GitHub Desktop.
Save sorahn/9442634 to your computer and use it in GitHub Desktop.
Simple hex helpers.
# 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