Skip to content

Instantly share code, notes, and snippets.

View Kevin-Prichard's full-sized avatar

Kevin Prichard Kevin-Prichard

  • Data Metaphysics
  • San Francisco, CA
View GitHub Profile
@Kevin-Prichard
Kevin-Prichard / json_data_dictionary.js
Last active September 13, 2015 04:52
Generate JSON data dictionary as key path list, for a JSON input (NodeJS). Helpful for analysing JSON documents and REST responses
#!/usr/bin/env node
var JSON = require('JSON');
var fs = require('fs');
var argv = require('yargs').argv;
var isObject = function(v) { return v && (typeof v==='object') && !('length' in v); };
var isArray = function(v) { return v && (typeof v==='object') && ('length' in v); };
var isPrimitive = function(v) { var res=(typeof v in {'boolean':true,'number':true,'string':true,'undefined':true}) || (v===null); return res;};
var keys = function(v) {keys=[]; for(var key in v){keys.push(key)} return keys};
@Kevin-Prichard
Kevin-Prichard / makefixtures_filtered
Created June 11, 2014 20:54
Create fixtures using custom Django query/.filter expressions. Include and exclude models as desired. Very flexible.
#Based on https://github.com/ericholscher/django-test-utils/blob/master/test_utils/management/commands/makefixture.py
#v0.1 -- current version
#known issues:
#no support for generic relations
#no support for one-to-one relations
from optparse import make_option
from django.core import serializers
from django.core.management.base import BaseCommand
from django.core.management.base import CommandError