Skip to content

Instantly share code, notes, and snippets.

@sorahn
Created March 9, 2014 03:46
Show Gist options
  • Select an option

  • Save sorahn/9442634 to your computer and use it in GitHub Desktop.

Select an option

Save sorahn/9442634 to your computer and use it in GitHub Desktop.

Revisions

  1. Daryl Roberts created this gist Mar 9, 2014.
    5 changes: 5 additions & 0 deletions gistfile1.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    # 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 +@