Skip to content

Instantly share code, notes, and snippets.

View mdigan's full-sized avatar

Matt Digan mdigan

View GitHub Profile
@datagrok
datagrok / gist:2199506
Last active December 16, 2024 16:14
Virtualenv's `bin/activate` is Doing It Wrong
@adamn
adamn / gist:1707483
Created January 30, 2012 23:26
Simple DynamoDB example for time-series data (i.e. counter for a given item_id at a time)
import time
import boto
from django.conf import settings
conn = boto.connect_dynamodb(aws_access_key_id=settings.AWS_ACCESS_KEY_ID,
aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY)
table_schema = conn.create_schema(
hash_key_name='item_id',
hash_key_proto_value='S',
@HenrikJoreteg
HenrikJoreteg / JS Util solution using underscore.js
Created October 22, 2010 21:20
Rather than creating some other util global, just extend underscore.js with any additional methods you want.
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/)
// Then, use underscore's mixin method to extend it with all your other utility methods
// like so:
_.mixin({
escapeHtml: function () {
return this.replace(/&/g,'&')
.replace(/>/g,'>')
.replace(/</g,'&lt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');