Skip to content

Instantly share code, notes, and snippets.

@rf-
Created August 28, 2011 23:33
Show Gist options
  • Save rf-/1177395 to your computer and use it in GitHub Desktop.
Save rf-/1177395 to your computer and use it in GitHub Desktop.
each_slice = (ary, slice_size) ->
for i in [0...ary.length] by slice_size
ary.slice(i, i + slice_size)
console.log each_slice("abcd", 2)
console.log each_slice("abcde", 2)
console.log each_slice("", 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment