Skip to content

Instantly share code, notes, and snippets.

@egoist
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save egoist/9b6f96ff92c1638f671a to your computer and use it in GitHub Desktop.

Select an option

Save egoist/9b6f96ff92c1638f671a to your computer and use it in GitHub Desktop.
# when the left one is an array literal
['a' 'b'] * 2 # array repetition
# when the right one is a string literal
<[ foo bar ]> * ', ' # array joining
# or when the left one is a string
y = 2
'z' * y # string repetition
words = text / ' ' # string division
# or even when the right one is either a string or a regexp
unspaced = text - /\s+/
[\a to \e] * '' - 'b'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment