Skip to content

Instantly share code, notes, and snippets.

View zain's full-sized avatar
💭
Livin' the dream.

Zain Memon zain

💭
Livin' the dream.
View GitHub Profile
"""
I've been thinking lately about how perfect Redis would be for storing a
simple social graph. I posited that it would be relatively few lines of code,
and that it'd be clean code too. So here it is: a basic social graph built on Redis.
"""
class FriendGraph(object):
def __init__(self, ring):
self.ring = ring
@zain
zain / gist:4291724
Created December 15, 2012 06:29 — forked from anonymous/gist:4291721
import re
import string
# find the first quote in a string
quotere = re.compile(
r"""(?P<quote>"[^\"\\]*(?:\\"|[^"])*") # Quote, possibly containing encoded
# quotation mark
\s*(?P<rest>.*)$ """,
re.VERBOSE)