This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CachedSessionHandler { | |
private static $LOG_SESSION_ACTIVITY = false; | |
private static $binding; | |
private $cache; | |
private $read_sessions = array(); | |
public static function bind($database) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def render_data(self, obj): | |
if isinstance(obj,dict): | |
value = obj.get(self.id, None) | |
if not value and 'fields' in obj: # added | |
value = obj['fields'].get(self.id, None) # added | |
else: | |
value = getattr(obj,self.id, None) | |
if callable(value): | |
return self.format_data(value()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python's datetime strftime doesn't handle dates before 1900. | |
# These classes override date and datetime to support the formatting of a date | |
# through its full "proleptic Gregorian" date range. | |
# | |
# Based on code submitted to comp.lang.python by Andrew Dalke | |
# | |
# >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%M/%d was a %A") | |
# '1850/08/02 was a Friday' | |
from datetime import date as real_date, datetime as real_datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
prunelocal = !sh -c 'git branch -d `git branch --merged | grep -v "^*"`' | |
pruneorigin = !sh -c 'git push origin `git branch -r --merged | grep \"^ origin/\" | grep -v "/master$" | sed "s/origin./:/g" | tr -d "\\n"`' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python shakes.py -t 15:00:00 -a | |
Total Performances: 18 | |
Candle Performances 16 | |
Twilight Candle Performances 14 | |
+--------------------------+-----------------------+-----------------------+-----------------------+-----------+-----------------------+--------------------+------------------+ | |
| Play | Curtain Up | Sunset | Time Difference | Candles | Twilight Date | Twilight Candles | Sun's Altitude | | |
+--------------------------+-----------------------+-----------------------+-----------------------+-----------+-----------------------+--------------------+------------------+ | |
| Henry VI, Part I | 1592/3/3 15:00:00 | 1592/3/3 17:50:08 | 2 hours, 50 minutes | Y | 1592/3/3 18:19:24 | N | 21:49:26.4 | | |
| Titus Andronicus | 1594/1/23 15:00:00 | 1594/1/23 16:40:13 | 1 hours, 40 minutes | Y | 1594/1/23 17:12:49 | Y | 10:20:11.3 | | |
| Taming of the Shrew | |
OlderNewer