Skip to content

Instantly share code, notes, and snippets.

@jhenry
Created December 11, 2009 07:03
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jhenry/254044 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby -wKU
text_source = ARGV[0] || 'ipsum'
filename = File.join(File.dirname(__FILE__), text_source + '.txt')
copy_to_use = File.read(filename)
if text_source == 'ipsum'
chopped_copy = copy_to_use.scan(/.*?[.!?](?:\s|$)/)
else
chopped_copy = copy_to_use.split(/\n\n/)
end
print chopped_copy[rand(chopped_copy.length)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment