Skip to content

Instantly share code, notes, and snippets.

View sivy's full-sized avatar

Steve Ivy sivy

View GitHub Profile
@sivy
sivy / archive.html
Last active December 10, 2015 00:48 — forked from anonymous/archive.html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Archive - {{ site.title }}</title>
<meta name="author" content="{{ user.display_name }}">
<meta name="description" content="{{ site.description }}">
<meta name="viewport" content="width=device-width; initial-scale=1; maximum-scale=1">
<link href="/atom.xml" rel="alternate" title="{{ site.url }} feed" type="application/atom+xml">
@sivy
sivy / redis_session_backend.py
Created April 11, 2012 01:53 — forked from mikeyk/redis_session_backend.py
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
from functools import wraps
def recordstats(stat_prefix=None):
"""Record that this function was called, with duration
Usage:
@recordstats('stats_prefix')
def my_view(request):
return HTTPResponse(the_content)
@sivy
sivy / jsonp_decorator.py
Created March 16, 2011 03:16
a jsonp view decorator for Django
def jsonp(f):
"""Wrap a json response in a callback, and set the mimetype (Content-Type) header accordingly
(will wrap in text/javascript if there is a callback). If the "callback" or "jsonp" paramters
are provided, will wrap the json output in callback({thejson})
Usage:
@jsonp
def my_json_view(request):
d = { 'key': 'value' }
@lusis
lusis / dba-user.json
Created January 7, 2011 11:24
Managing MySQL user accounts with Chef
{
"id":"dbauser",
"uid":506,
"comment":"DBA User",
"shell":"/bin/bash",
"groups": [
"sysadm",
"dba"
],
"ssh_key": "XXXXXXXXXX"
@sivy
sivy / app.js
Created October 19, 2010 18:20
issue with collection.update callback params
/**
update stats for the URL
*/
hit_emitter.on('newHit', function(url, hit){
var data = { "$push": { "stats.hits": hit }, "$inc": { "stats.hitcounter": 1 } }
urlProvider.update(url, data, function(error, url){
console.log('updated hit: ' + JSON.stringify(url));
});
});
@sivy
sivy / steveivy-resume.md
Created October 5, 2010 16:05
My name is Steve Ivy and I write about technology, the open web, social software, and general nerdity on monkinetic.com. I spend my days building large-scale CMS solutions Six Apart. With the recent merger, I'm looking for my next opportunity.