Skip to content

Instantly share code, notes, and snippets.

@kenany
Created September 11, 2012 00:32
Show Gist options
  • Save kenany/3695071 to your computer and use it in GitHub Desktop.
Save kenany/3695071 to your computer and use it in GitHub Desktop.
Herp Derp YouTube Comments (CoffeeScript edition)
# labs.tannr.com/projects/herpderp/herp.js
randomDerp = ->
@derpOriginal = $(@).html()
$(@).click ->
$(@).html @derpOriginal
randomLength = Math.floor(Math.random() * 20) + 1
wordArray = new Array
x = 0
while x < randomLength
randomBit = Math.floor(Math.random() * 2)
if randomBit is 1
wordArray[x] = 'herp'
else
wordArray[x] = 'derp'
x++
$(@).addClass 'derped'
"<p>#{ wordArray.join(' ') }</p>"
$('.comment-text, p.ctx').not('.derped').html randomDerp
setInterval ->
$('.comment-text, p.ctx').not('.derped').html randomDerp
, 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment