Skip to content

Instantly share code, notes, and snippets.

@waynemoore
waynemoore / month_day_range.py
Created July 27, 2011 11:01
Get first and last day of a particular month using python-dateutil.
import datetime
# requires python-dateutil (http://labix.org/python-dateutil)
from dateutil.relativedelta import relativedelta
def get_month_day_range(date):
"""
For a date 'date' returns the start and end date for the month of 'date'.
Month with 31 days:
@robspychala
robspychala / redis_webhook
Created April 26, 2011 16:32
Simple example of a redis based webhook implementation. (gist has external dependancies, but they should be easy to remove)
#!/usr/bin/env python2.6
import sys, urllib2, urllib, time, threading, signal
sys.path.append('support/lib')
import settings
from settings import logging
from lib import taskqueue
@oppara
oppara / gist:132274
Created June 18, 2009 23:13
php: mb_trim
function mb_trim( $str ) {
return mb_ereg_replace(
'^[[:space:]]*([\s\S]*?)[[:space:]]*$', '\1', $str );
}