Skip to content

Instantly share code, notes, and snippets.

@thurloat
Created April 12, 2012 20:10
Show Gist options
  • Save thurloat/2370656 to your computer and use it in GitHub Desktop.
Save thurloat/2370656 to your computer and use it in GitHub Desktop.
Hardcore Coffeescript
class @SyncView
for season in ["spring", "summer", "fall", "winter"]
for field in ["title", "story"]
fieldPropertyName = season + field.charAt(0).toUpperCase() + field.substr(1)
pName = "#{ fieldPropertyName }ToModel"
TrendFormView.prototype[pName] = _.bind (s, f) ->
@seasonFieldToModel s, f
, TrendFormView.prototype, season, field
@honza
Copy link

honza commented Apr 12, 2012

lols

@thurloat
Copy link
Author

generate mah own methods at runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment