Skip to content

Instantly share code, notes, and snippets.

From 0952e591e94a44afaa0ac27eff1f4f71c6423627 Mon Sep 17 00:00:00 2001
From: Colin Sullivan <colinsul@gmail.com>
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(-)
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 npm@0.3.4
npm info using node@v0.4.1
npm verb config file /Users/colin/.npmrc
npm verb config file /opt/local/etc/npmrc
@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
@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 / 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 / celeryd
Created September 16, 2011 21:32
Celery config file
# Name of nodes to start, here we have a single node
CELERYD_NODES="w1"
# or we could have three nodes:
#CELERYD_NODES="w1 w2 w3"
# Where to chdir at start.
CELERYD_CHDIR="/mnt/hgfs/Concert/concertapp/"
# How to call "manage.py celeryd_multi"
CELERYD_MULTI="$CELERYD_CHDIR/manage.py celeryd_multi"
@colinsullivan
colinsullivan / EventHandlerTest.ck
Created December 8, 2011 08:59
Trying to get a simple event handler interface in ChucK
/**
My goal is the interface at the bottom of the file:
MyWatcher c;
HappyEvent a;
spork ~ c.watch(a);
When this `watch` method is called, the `MyWatcher` instance `c` should handle the call to
@colinsullivan
colinsullivan / ViewController.mm
Created January 12, 2012 07:02
Simple Audio and Accelerometer Callbacks that are creating artifacts.
#define SRATE 44100
#define FRAMESIZE 512
#define NUMCHANNELS 2
double g_t;
bool g_sineSwitch;
double g_freq;
@implementation hw1ViewController
@colinsullivan
colinsullivan / hyde_error.log
Created February 7, 2012 05:57
Hyde site generation error log
basillamus:colin-sullivan.com 09:54 PM $ hyde gen -r
21:54:34 hyde.engine Reading site configuration from [/Users/colin/Projects/colin-sullivan.com/site.yaml]
21:54:35 hyde Regenerating the site...
21:54:35 hyde.engine Reading site contents
21:54:35 hyde.engine Generating site at [/Users/colin/Projects/colin-sullivan.com]
21:54:35 hyde.engine Configuring the template environment
21:54:36 hyde.engine Generating site to [/Users/colin/Projects/colin-sullivan.com/deploy]
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/hyde-0.8.5a13-py2.6.egg/hyde/generator.py", line 125, in get_dependencies
else self.update_deps(resource)
@colinsullivan
colinsullivan / hyde_tracebacks.log
Created February 7, 2012 21:55
Hyde gen -r traceback when killed
basillamus:colin-sullivan.com 01:20 PM $ hyde gen -r
13:21:01 hyde.engine Reading site configuration from [/Users/colin/Projects/colin-sullivan.com/site.yaml]
13:21:02 hyde Regenerating the site...
13:21:02 hyde.engine Reading site contents
13:21:02 hyde.engine Generating site at [/Users/colin/Projects/colin-sullivan.com]
13:21:02 hyde.engine Configuring the template environment
13:21:03 hyde.engine Generating site to [/Users/colin/Projects/colin-sullivan.com/deploy]
^CTraceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/hyde", line 9, in <module>
load_entry_point('hyde==0.8.5a13', 'console_scripts', 'hyde')()