Skip to content

Instantly share code, notes, and snippets.

@mtigas
Created April 9, 2012 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtigas/2345152 to your computer and use it in GitHub Desktop.
Save mtigas/2345152 to your computer and use it in GitHub Desktop.
"""
forked from django.contrib.webdesign.lorem_ipsum
https://github.com/django/django/blob/master/django/contrib/webdesign/lorem_ipsum.py
import instagram
for p in instagram.paragraphs(6):
print p+"\n"
"""
import random
def sentence():
"""
Returns a randomly generated sentence of lorem ipsum text.
The first word is capitalized, and the sentence ends in either a period or
question mark. Commas are added at random.
"""
# Determine the number of comma-separated sections and number of words in
# each section for this sentence.
sections = [random.choice([u'instagram', u'facebook']) for i in range(random.randint(1, 5))]
s = u', '.join(sections)
# Convert to sentence case and add end punctuation.
return u'%s%s%s' % (s[0].upper(), s[1:], random.choice('?.'))
def paragraph():
"""
Returns a randomly generated paragraph of lorem ipsum text.
The paragraph consists of between 1 and 4 sentences, inclusive.
"""
return u' '.join([sentence() for i in range(random.randint(1, 4))])
def paragraphs(count, common=True):
"""
Returns a list of paragraphs as returned by paragraph().
If `common` is True, then the first paragraph will be the standard
'lorem ipsum' paragraph. Otherwise, the first paragraph will be random
Latin text. Either way, subsequent paragraphs will be random Latin text.
"""
paras = []
for i in range(count):
paras.append(paragraph())
return paras
@mtigas
Copy link
Author

mtigas commented Apr 9, 2012

Instagram. Instagram, instagram, instagram, instagram? Instagram, instagram, instagram, instagram, instagram? Instagram, instagram.

Instagram.

Instagram, instagram? Instagram. Instagram, instagram, instagram, instagram, instagram?

Instagram, instagram, instagram, instagram, instagram.

Instagram, instagram, instagram.

Instagram, instagram, instagram, instagram, instagram. Instagram, instagram, instagram? Instagram, instagram, instagram, instagram, instagram. Instagram, instagram, instagram.

@mtigas
Copy link
Author

mtigas commented Apr 9, 2012

FIXED:

Facebook? Instagram?

Instagram, facebook? Instagram, instagram. Facebook? Facebook, facebook, instagram, facebook, instagram?

Instagram. Facebook, instagram, facebook, facebook, facebook. Facebook, facebook, facebook, instagram?

Instagram, facebook, instagram, instagram.

Facebook, instagram.

Facebook, instagram, facebook, instagram? Facebook, instagram, facebook, instagram, instagram.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment