Skip to content

Instantly share code, notes, and snippets.

View sancau's full-sized avatar

Alexander Tatchin sancau

View GitHub Profile
@jobliz
jobliz / RedisPythonPubSub1.py
Created May 4, 2012 17:58
A short script exploring Redis pubsub functions in Python
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
@elijahmanor
elijahmanor / emailPattern.coffee
Created February 8, 2012 05:37
Regular Expressions in CoffeeScript
emailPattern = /// ^ #begin of line
([\w.-]+) #one or more letters, numbers, _ . or -
@ #followed by an @ sign
([\w.-]+) #then one or more letters, numbers, _ . or -
\. #followed by a period
([a-zA-Z.]{2,6}) #followed by 2 to 6 letters or periods
$ ///i #end of line and ignore case
if "[email protected]".match emailPattern
console.log "E-mail is valid"