Skip to content

Instantly share code, notes, and snippets.

@hugomaiavieira
Created October 10, 2013 23:13
Show Gist options
  • Save hugomaiavieira/6927093 to your computer and use it in GitHub Desktop.
Save hugomaiavieira/6927093 to your computer and use it in GitHub Desktop.
Lorem ipsum generator in ruby for seed use
DICT = [ 'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing',
'elit', 'sed', 'in', 'leo', 'sit', 'amet', 'quam', 'sollicitudin', 'accumsan',
'integer', 'eu', 'tempor', 'nisl', 'ut', 'ornare', 'aliquet', 'massa', 'vitae',
'posuere', 'aenean', 'neque', 'libero', 'dignissim', 'nec', 'tincidunt',
'vitae', 'placerat', 'sed', 'arcu', 'donec', 'elementum', 'cursus', 'lorem',
'nec', 'ullamcorper', 'etiam', 'feugiat', 'venenatis', 'sem', 'id', 'commodo',
'curabitur', 'in', 'nulla', 'mi', 'praesent', 'mattis', 'porttitor', 'ante',
'ac', 'pretium', 'tortor', 'vulputate', 'tincidunt', 'nunc', 'eu', 'risus',
'nec', 'enim', 'fringilla', 'scelerisque', 'id', 'quis', 'lorem', 'maecenas',
'elementum', 'mauris', 'eu', 'arcu', 'porttitor', 'pretium', 'sed', 'rhoncus',
'feugiat', 'sollicitudin', 'suspendisse', 'potenti' ]
NAMES = [ 'Luiz', 'Silva', 'Salles', 'Albuquerque', 'Angela', 'Maria',
'Gonçalves', 'Motta', 'Carvalho' ]
def words(number)
(0...number).map { DICT[rand(DICT.length)] }.join(' ')
end
def names
(0..4).map { NAMES[rand(NAMES.length)] }.join(' ')
end
def paragraphs(number, opts={})
opts.merge(html: false)
paragraphs = ''
number.times do |time|
paragraphs += '<p>' if opts[:html]
paragraphs += words(50)
paragraphs += '</p>' if opts[:html]
end
paragraphs
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment