Skip to content

Instantly share code, notes, and snippets.

View hughes's full-sized avatar

Matt Hughes hughes

View GitHub Profile
@hughes
hughes / pie.py
Created December 11, 2012 19:12 — forked from EdwardIII/pie.py
from tastypie.resources import ModelResource, ALL_WITH_RELATIONS
from people.models import Basket, Person
from tastypie import fields
from tastypie.authentication import Authentication
from tastypie.authorization import Authorization
class BasketAuthorization(Authorization):
def is_authorized(self, request, object=None):
print request
if request and hasattr(request, 'user') and hasattr(request.user, 'employer'):
@hughes
hughes / 0_reuse_code.js
Created July 9, 2014 02:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hughes
hughes / README.md
Last active August 29, 2015 14:19 — forked from mbostock/.block

From Wikipedia:

Epicyclic gearing or planetary gearing is a gear system consisting of one or more outer gears, or planet gears, revolving about a central, or sun gear. … Epicyclic gearing systems also incorporate the use of an outer ring gear or annulus, which meshes with the planet gears.

Use the menu in the top-left to change the frame of reference, fixing the specified gear in-place.

@hughes
hughes / README.md
Last active August 29, 2015 14:23 — forked from mbostock/.block
d3 pack layout with custom group padding

The padding parameter previously was constant across the layout, and required a second pass of d3_layout_packSiblings.

With this change, it is possible to specify padding on any node, even group nodes. This value is added to the outer radius of the node when packing the nodes