This file contains 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
#!/usr/bin/env ruby | |
# | |
# Print output as if someone was typing it. | |
# | |
# * random short intervals between characters | |
# | |
# I have no idea why this seems so neat to me. | |
# Try piping the output of w3m -dump to it. | |
# | |
# -jdc 2013-06-20 |
This file contains 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
// Return true/false whether input string is a palindrome | |
function is_palindrome(input) { | |
// normalize input to ignore case and non-word chars | |
input = input.toUpperCase().replace(/\W/g,""); | |
// anything less than two chars is automatically a palindrome | |
return (input.length < 2) ? | |
true : | |
// if first and last chars differ, not a palindrome |