Skip to content

Instantly share code, notes, and snippets.

@domkm
Created August 30, 2012 18:13
Show Gist options
  • Save domkm/3536189 to your computer and use it in GitHub Desktop.
Save domkm/3536189 to your computer and use it in GitHub Desktop.
Dev Bootcamp Birthday Torture
def happy_birthday(name, torture_level = 100)
hb = "Happy Birthday to You."
song = "#{hb} #{hb} Happy Birthday Dear #{name}. #{hb}"
song.chars.reduce do |memo, char|
%w[a e i o u y].include?(char) ? memo + char * torture_level : memo + char
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment