Skip to content

Instantly share code, notes, and snippets.

View blorenz's full-sized avatar

Brandon Lorenz blorenz

View GitHub Profile
@blorenz
blorenz / machine.js
Last active December 12, 2019 16:38
Generated by XState Viz: https://xstate.js.org/viz
const groupGoalMachine = Machine({
id: 'groupGoal',
initial: 'listing',
context: {
goal:null
},
states: {
listing: {
entry: ['emptyGoal'],
@blorenz
blorenz / SketchSystems.spec
Last active October 25, 2019 17:34
My Awesome Sketch
My Awesome Sketch
First State
tick -> Second sat
Second sat
tick -> First State
@blorenz
blorenz / machine.js
Last active September 1, 2019 17:46
Generated by XState Viz: https://xstate.js.org/viz
const registrationMachine = Machine(
{
id: `registration`,
initial: `codeEntry`,
context: {
user: undefined,
},
states: {
codeEntry: {
on: { SUBMIT: `submitting` },
import { InMemoryCache } from 'apollo-cache-inmemory';
import { ApolloClient } from 'apollo-client';
import { ApolloLink } from 'apollo-link';
import { onError } from 'apollo-link-error';
import { createUploadLink } from 'apollo-upload-client';
import React from 'react';
import { ApolloProvider } from 'react-apollo';
import ReactDOM from 'react-dom';
*PPD-Adobe: "4.3"
*%%%% PPD file for ZPL Label Printer with CUPS.
*%%%% Created by the CUPS PPD Compiler CUPS v2.1.3.
*% Copyright 2007-2014 by Apple Inc.
*% Copyright 1997-2007 by Easy Software Products.
*%
*% These coded instructions, statements, and computer programs are the
*% property of Apple Inc. and are protected by Federal copyright
*% law. Distribution and use rights are outlined in the file "LICENSE.txt"
*% which should have been included with this file. If this file is
@blorenz
blorenz / install.sh
Created October 18, 2016 19:12 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
class Annotation(models.Model):
datapoint = models.ForeignKey('datapoint.Datapoint', related_name='%(class)s_parent_datapoint_relation')
owner = models.ForeignKey('users.User', related_name='%(class)s_creator_relation')
tags = models.ManyToManyField('tags.Tag', related_name="%(class)s_tags_relation", blank=True)
# Key fields from the Annotator JSON Format: http://docs.annotatorjs.org/en/latest/annotation-format.html
annotator_schema_version = models.CharField(max_length=8, blank=True)
text = models.TextField(blank=True)
quote = models.TextField()
from django.forms import widgets
from datapoint.models import Datapoint, Annotation
from rest_framework import serializers
from rest_framework.exceptions import ParseError
from tags.serializers import TagSerializer
from tags.models import Tag
from users.serializers import UserSerializer
import simplejson as json
@blorenz
blorenz / gist:cf54986669acb8dc778d
Created July 28, 2014 18:47
Rotating photos based on EXIF data
from PIL import Image, ExifTags
photo = Image.open(args['filename'])
photo_exif = None
try:
# See if this image has any exif
photo_exif = Image.open(args['filename'])._getexif()
except:
pass
@blorenz
blorenz / Ipython Notebook on Mac
Last active December 26, 2015 17:09
Install IPython notebook on Mac for Django
pip install ipython sphinx pyzmq pygments tornado nose django-extensions
easy_install readline pyzmq
# Now can run with django
# ./manage.py shell_plus --notebook