Skip to content

Instantly share code, notes, and snippets.

View ProjectCheshire's full-sized avatar

Jessamyn Hodge ProjectCheshire

  • Boston, MA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am projectcheshire on github.
  • I am mynja (https://keybase.io/mynja) on keybase.
  • I have a public key ASCiHWVkAPZM8cU-r-90lS23EtXTeId58qD9oYuUM7yOJAo

To claim this, I am signing this object:

@ProjectCheshire
ProjectCheshire / s107_cal.md
Last active March 30, 2020 21:03
S107 Events Cycle

Events

@ProjectCheshire
ProjectCheshire / python_decorator_guide.md
Created July 9, 2018 23:22 — forked from Zearin/python_decorator_guide.md
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@ProjectCheshire
ProjectCheshire / Auto.py
Last active August 16, 2020 13:19
Autoschemer.py
import os
import importlib
from inspect import getmembers, isclass
from graphene import ObjectType
from logzero import logger
def schema_operations_builder(operationName, operationModule, operationBase, clsName):
op_base_classes = build_base_classes(operationName, operationModule, operationBase, clsName)
@ProjectCheshire
ProjectCheshire / convert-geojson-to-wkt.py
Created September 28, 2017 20:47 — forked from drmalex07/convert-geojson-to-wkt.py
Convert GeoJSON to/from WKT in Python. #python #geojson #geometry
import json
import geojson
from shapely.geometry import shape
o = {
"coordinates": [[[23.314208, 37.768469], [24.039306, 37.768469], [24.039306, 38.214372], [23.314208, 38.214372], [23.314208, 37.768469]]],
"type": "Polygon"
}
s = json.dumps(o)
@ProjectCheshire
ProjectCheshire / baseResolvers.js
Created March 14, 2017 17:59 — forked from thebigredgeek/baseResolvers.js
Breed-able Resolvers
import { AlreadyAuthenticatedError, NotAuthenticatedError, NotAuthorizedError } from '../errors/functional';
import createResolver from '../lib/createResolver';
export const baseResolver = createResolver();
export const isAuthenticatedResolver = baseResolver.createResolver(
(root, args, context) => {
if (!context.user || !context.user.id) throw new NotAuthenticatedError();
}
@ProjectCheshire
ProjectCheshire / location.graphql
Created March 14, 2017 17:58 — forked from thebigredgeek/location.graphql
Apollo / GraphQL basics
type Location implements Resource {
# Primary key
id: ID!
# Google's name for the Location
googleName: String!
# Google's ID for the Location
googleId: ID!
# Google's Place ID for the Location
googlePlaceId: ID!
# Google's Timezone ID for the Location
1. Build GraphQL server using `express-graphql` package.
2. Configure `schema.js` file.
3. Query for data.
var getNode = function(id, type) {
var deferred = q.defer();
var query = [
'START entity=node:nodes(type = {type})',
'MATCH entity',
'WHERE entity.id = {id}',
'RETURN entity;'
].join('\n');
var params = {
var session = require('./session')
class User {
/**
Creates a User Node in neo4j
* @param {string} uuid (required) - refference id
* @param {string} parentId (required only if reffered by another user) - uuid of parentId
* @param {int/float} sRate (optional) - special rate between user and
* returns Promise
*/
static create(data,parentId=null,sRate = null){