Skip to content

Instantly share code, notes, and snippets.

View ddohler's full-sized avatar

Derek Dohler ddohler

  • Philadelphia, PA, USA
View GitHub Profile
@ddohler
ddohler / vimrc
Created October 6, 2014 14:06
.vimrc
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
@ddohler
ddohler / extensions.py
Created September 29, 2015 17:34
Subclass F objects to provide JSONB field access in Django 1.8+
from django.db.models import F
# Needs expansion but may eventually allow things like:
# recs = Record.objects.annotate(num_killed=JBF('data').jbPath(Value("{Accident Details, Number killed}"))).filter(num_killed__asint=1)
class JBF(F):
JB_PATH = '#>'
JB_PATH_STR = '#>>'
JB_FIELD = '->'
JB_FIELD_STR = '->>'
@ddohler
ddohler / jsonschema.json
Last active July 5, 2018 13:09
JSON Schema Example
{
"type": "object",
"title": "",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"photo": {
"type": "array",
"items": {
"$ref": "#/definitions/photo"
},
@ddohler
ddohler / analyze1.json
Created July 10, 2017 18:51
DRIVER Query Plans
[
{
"Plan": {
"Node Type": "Hash Join",
"Join Type": "Inner",
"Startup Cost": 85.62,
"Total Cost": 485.81,
"Plan Rows": 35,
"Plan Width": 2676,
"Actual Startup Time": 3.867,