Skip to content

Instantly share code, notes, and snippets.

@stevenocchipinti
Last active May 15, 2018 01:48
Show Gist options
  • Save stevenocchipinti/5261dc00f28b42e059d4d23cf3f74208 to your computer and use it in GitHub Desktop.
Save stevenocchipinti/5261dc00f28b42e059d4d23cf3f74208 to your computer and use it in GitHub Desktop.
PPAP
# https://www.youtube.com/watch?v=Ct6BUPvE2sM
def ouhh(left, right)
if left == "pen" && right == "apple"
"apple-pen"
elsif left == "pen" && right == "pineapple"
return "pineapple-pen"
elsif left == "apple-pen" && right == "pineapple-pen"
return "pen-pineapple-apple-pen"
end
end
def i_have_a(thing)
if thing == "apple" || thing == "pineapple" || thing == "pen"
puts "I have a #{thing}"
elsif thing.include? "-"
puts "ouhh! #{thing}"
else
puts thing
end
end
def stretch(thing)
puts thing.sub(/[aeiou]/) { |vowel| vowel * 10 }
end
i_have_a "pen"
i_have_a "apple"
apple_pen = ouhh "pen", "apple"
i_have_a apple_pen
i_have_a "pen"
i_have_a "pineapple"
pineapple_pen = ouhh "pen", "pineapple"
i_have_a pineapple_pen
stretch apple_pen
stretch pineapple_pen
i_have_a ouhh apple_pen, pineapple_pen
@stevenocchipinti
Copy link
Author

ruby /tmp/ppap.rb

I have a pen
I have a apple
ouhh! apple-pen
I have a pen
I have a pineapple
ouhh! pineapple-pen
aaaaaaaaaapple-pen
piiiiiiiiiineapple-pen
ouhh! pen-pineapple-apple-pen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment