Skip to content

Instantly share code, notes, and snippets.

@jvimal
Created April 30, 2011 19:36
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 jvimal/949923 to your computer and use it in GitHub Desktop.
Save jvimal/949923 to your computer and use it in GitHub Desktop.
linking up
# add it at the end of users.py
def linkup():
"""Links up two random people from the waiting list."""
num_waiting = r.scard('waiting')
if num_waiting < 2:
# Cannot link up
return False
num1 = r.spop('waiting')
num2 = r.spop('waiting')
# our routing table
r.set(num1, num2)
r.set(num2, num1)
text = "You're now connected to a random stranger!"
send_sms(num1, text)
send_sms(num2, text)
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment