Skip to content

Instantly share code, notes, and snippets.

View aezell's full-sized avatar
😶

Alex Ezell aezell

😶
View GitHub Profile
@aezell
aezell / hash_join.py
Created March 14, 2011 15:42
General hash_join function
def hash_join(left, right, join_key, attr_keys, outer=True):
"""
Allows you to join the keys/values from a list of dictionaries as the
attributes of a given list of objects.
Params::
- left - list of objects to join to
- right - list of dictionaries from which to get joined data
- join_key - attribute of both object and dictionary with which we can match
@aezell
aezell / cached_db_session.py
Created February 2, 2011 21:13
DB-backed Cached Session in Python
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase
from django.core.cache import cache
from PHPSerialize import PHPSerialize
from PHPUnserialize import PHPUnserialize
from session_models import SessionEntry
from datetime import timedelta
from sqlalchemy import func, text
from sharding import Session
@aezell
aezell / sessions.php
Created February 2, 2011 21:09
DB-backed Cached Session Handling in PHP
<?php
class CachedSessionHandler {
private static $LOG_SESSION_ACTIVITY = false;
private static $binding;
private $cache;
private $read_sessions = array();
public static function bind($database)
@aezell
aezell / google_url.py
Created January 11, 2011 22:08
Messing around with goo.gl URL shortener API
import json, urllib2, pprint
"""
Mess around with goo.gl shortener API
"""
kind = "SHORTEN"
key = "YOUR_KEY"
api_url = "https://www.googleapis.com/urlshortener/v1/url?key=%s" % key
@aezell
aezell / config.log
Created November 11, 2010 16:20
error when trying to install libvpx brew install
>>> brew install -vd libvpx
==> Build Environment
CC: /usr/bin/cc => /usr/bin/gcc-4.0
CXX: /usr/bin/c++ => /usr/bin/c++-4.0
LD: /usr/bin/cc => /usr/bin/gcc-4.0
CFLAGS: -O3 -march=nocona -mfpmath=sse -w -pipe
CXXFLAGS: -O3 -march=nocona -mfpmath=sse -w -pipe
MAKEFLAGS: -j2
==> Downloading http://webm.googlecode.com/files/libvpx-v0.9.2.tar.bz2
File already downloaded and cached to /Users/alex2/Library/Caches/Homebrew
// init the storage object
var people = new Lawnchair('people');
// save an object
var me = {name: 'alex'};
people.save(me);
// what is the people object?
console.log(people)