Skip to content

Instantly share code, notes, and snippets.

@colinsullivan
colinsullivan / oosample.coffee
Created June 7, 2011 03:57
Sample OO programming
class Provider extends Backbone.Atlas.Model
user_check_in: (user) ->
console.log 'user checked in'
class CoffeeShop extends Provider
user_check_in: (user) ->
super user
console.log 'give user menu'
@colinsullivan
colinsullivan / django-tastypie_user-profile-field.py
Created April 12, 2011 17:13
This is a django-tastypie resource field that incorporates the Django user profile into a model resource for a `User` transparently.
###
# This field is used on the user model to transparently add stuff from the
# user profile object into the user resource.
#
# Copyright (c) 2012 Colin Sullivan <colinsul [at] gmail.com>
# Licensed under the MIT License.
###
class UserProfileManyToManyField(fields.ManyToManyField):
###
# We will override the dehydrate method so when we're trying to dehydrate
@colinsullivan
colinsullivan / Delete_week_old_contents.sh
Created April 6, 2011 00:39
A script to delete any item inside a particular folder if it is older than 7 days.
find /path/to/folder -not \( -path "/path/to/folder" \) -Btime +7d -delete
ColinsMB:npm 08:55 PM $ sudo node cli.js install -ddd
Password:
npm info it worked if it ends with ok
npm verb cli [ 'install',
npm verb cli '--loglevel',
npm verb cli 'silly' ]
npm info using [email protected]
npm info using [email protected]
npm verb config file /Users/colin/.npmrc
npm verb config file /opt/local/etc/npmrc
From 0952e591e94a44afaa0ac27eff1f4f71c6423627 Mon Sep 17 00:00:00 2001
From: Colin Sullivan <[email protected]>
Date: Tue, 8 Feb 2011 20:49:37 -0500
Subject: [PATCH] Catch NotFound error instead of all errors...
to create resource if it doesn't exist.
---
tastypie/resources.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)