Skip to content

Instantly share code, notes, and snippets.

View dnouri's full-sized avatar

Daniel Nouri dnouri

View GitHub Profile
@dnouri
dnouri / gist:867230
Created March 12, 2011 13:25
guess_time: Parsing time from user input.
import time
def guess_time(s):
"""
>>> guess_time('20:00')
(20, 0)
>>> guess_time(' 23:59')
(23, 59)
>>> guess_time('20:00foo')
(20, 0)
@dnouri
dnouri / cache.py
Created February 10, 2011 15:39
A 136 line alternative to plone.{app.,}caching that includes policy
import datetime
import Acquisition
from zope import interface
from zope import component
import plone.postpublicationhook.interfaces
#from collective.skinny.interfaces import IPublicLayer