Skip to content

Instantly share code, notes, and snippets.

View pwwilson's full-sized avatar

Patrick Wilson pwwilson

View GitHub Profile
@pwwilson
pwwilson / APIError.swift
Created March 17, 2022 18:19
Backflip Error Messaging
//
// APIError.swift
// Backflip
//
// Created by Patrick Wilson on 11/16/21.
//
import Foundation
public enum APIError {
"""Segment.io analytics library interface."""
from uuid import uuid4
import analytics
from django.conf import settings
analytics.write_key = settings.SEGMENT_API_KEY
def identify_user_persona(user):
"""Execute segment identify action for user."""
@pwwilson
pwwilson / segment.py
Created October 14, 2021 17:54
Backflip Segment -> Hubspot code
"""Segment.io analytics library interface."""
from uuid import uuid4
import analytics
from django.conf import settings
analytics.write_key = settings.SEGMENT_API_KEY
def identify_user_persona(user):
"""Execute segment identify action for user."""
@pwwilson
pwwilson / Ownable.sol
Created June 16, 2018 04:43
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.23;
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
pragma solidity ^0.4.24;
import "./Ownable.sol";
contract ShitCoinShowdown is Ownable {
event ContractUpgrade(address newContract);
address public newContractAddress;
@pwwilson
pwwilson / Serializable.swift
Created March 4, 2017 01:01 — forked from anaimi/Serializable.swift
Serialize a Swift object to JSON or Dictionary, with selective properties.
/*
Purpose:
Convert (or Serialize) an object to a JSON String or Dictionary.
Usage:
Use 'Serialize.toJSON' on instances of classes that:
- Inherit from NSObject
- Implement 'Serializable' protocol
- Implement the property 'jsonProperties' and return an array of strings with names of all the properties to be serialized
import uuid
from django.db import models
from django_extensions.db.fields.json import JSONField
from djorm_pgarray.fields import TextArrayField
from django.contrib.auth.models import User
# you could make a monkuser class and use the standard user model to only handle auth
# https://docs.djangoproject.com/en/dev/topics/auth/customizing/#extending-the-existing-user-model
def status_code_behavior(r):
"""
Holds a dictionary of all possible HTTP status codes and returns a string value.
:param code: HTTP Response status code
:return: {String}
"""
# Copied from multiple sources...
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Response_codes
# http://httpstatus.es/
// Useful Macros.
// The best place to import this is in your project's pch file.
// See http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/ for details.
// Most current version at https://gist.github.com/325926 along with usage notes.
#ifndef jcscommonmacros
#define jcscommonmacros_1_0 10000
#define jcscommonmacros jcscommonmacros_1_0
#endif
@pwwilson
pwwilson / Player.js
Created October 10, 2013 16:45
code
/*
* --------------------------------------------------------
*
* Global Audio Player
* Base class
*
* --------------------------------------------------------
*/