Created
November 2, 2016 21:28
-
-
Save Dan-Q/09800edbd524633d656cd68c00fe19fb to your computer and use it in GitHub Desktop.
Ugly Ruby code to split a message into two messages with alternate words escaped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msg = "Your message goes here." | |
[true, false].each{|x|puts msg.split(' ').map{|w|(x = !x) ? w : ('_'*w.length)}.join(' ')} | |
# Result: | |
# ____ message ____ here. | |
# Your _______ goes _____ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quickly thrown together in IRB when I wanted to send a long message to two people over Slack who claimed to be in the same place. Not perfect, certainly not secure, also damn ugly code.