Created
October 23, 2015 01:20
-
-
Save will3216/fabecc1cf828c73ffa1a to your computer and use it in GitHub Desktop.
Some random console commands for use in rails
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
# Generate random text via an online API: Useful for generating fake data | |
# For more options see: https://baconipsum.com/json-api/ | |
#Generate random sentence | |
require 'open-uri' | |
def random_sentence(count=1); open("https://baconipsum.com/api/?type=meat-and-filler&sentences=#{count}&format=text&start-with-lorem=0").read; end | |
# < random_sentence | |
# => "Bacon ipsum dolor amet aute brisket cupidatat ribeye, ball tip consequat shoulder pig chuck adipisicing shankle." | |
# Random paragraph | |
def random_paragraph(count=1); open('https://baconipsum.com/api/?type=meat-and-filler¶s=#{count}&format=text&start-with-lorem=0').read; end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment