public
Last active

More CoffeeScriptish

  • Download Gist
gistfile1.coffee
CoffeeScript
1 2 3 4 5 6 7 8 9 10
do ($ = jQuery) ->
$.fn.zebraTable = (options) ->
defaults =
evenColor: '#ccc'
oddColor : '#eee'
 
options = $.extend(defaults, options)
@each ->
$("tr:even", @).css('background-color', options.evenColor)
$("tr:odd", @).css('background-color', options.oddColor)

do ($ = jQuery) ->
$.fn.zebraTable = (options) ->
defaults =
evenColor: '#ccc'
oddColor : '#eee'

options = $.extend defaults, options
@each ->
  $("tr:even", @).css 'background-color', options.evenColor
  $("tr:odd", @).css 'background-color', options.oddColor

You can also reduce some ( & )

@pfinkbeiner It's possible he included the parens on purpose. I know I do in all my CoffeeScript. It means less chance of misunderstanding how a function call is going to be parsed... especially if you code Python rather than Ruby or Haskell.

Also, if you ever see this, edit your comment and indent all your code by 4 spaces. That's the simplest way to indicate a code block in markdown.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.