Skip to content

Instantly share code, notes, and snippets.

@skalnik
Created June 8, 2011 21:36
Show Gist options
  • Save skalnik/1015477 to your computer and use it in GitHub Desktop.
Save skalnik/1015477 to your computer and use it in GitHub Desktop.
!SLIDE
@@@javascript
window.Money = class Money
constructor: (rawString) ->
@cents = @parseCents rawString
parseCents: (rawString="") ->
[dollars, cents] =
rawString.match(/(\d+)/g) ? [0,0]
+ cents + 100 * dollars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment