Skip to content

Instantly share code, notes, and snippets.

View rtt's full-sized avatar
🚍
' DROP TABLE user_statuses; --

Rich Taylor rtt

🚍
' DROP TABLE user_statuses; --
View GitHub Profile
@glenrobertson
glenrobertson / flask_cache_response_decorator.py
Last active January 15, 2022 21:15
Flask response cache decorator
import datetime
import time
from functools import wraps
from wsgiref.handlers import format_date_time
from flask import make_response
def cache(expires=None, round_to_minute=False):
"""
Add Flask cache response headers based on expires in seconds.
@robcowie
robcowie / python_php_extract.py
Created April 5, 2013 14:44
Python version of php's best feature
def extract(d):
import inspect
inspect.getouterframes(inspect.currentframe())[1][0].f_locals.update(d)
@Yavari
Yavari / README.markdown
Created February 23, 2012 09:00 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@b3sam
b3sam / gist:3940886
Created October 23, 2012 19:04
:awe:
class WeatherTypes
{
const NOT_AVAILABLE = 'NA';
const CLEAR_NIGHT = 0;
const SUNNY_DAY = 1;
const PARTLY_CLOUDY_NIGHT = 2;
const PARTLY_CLOUDY_DAY = 3;
const NOT_USED = 4;
const MIST = 5;
const FOG = 6;