Skip to content

Instantly share code, notes, and snippets.

View faassen's full-sized avatar

Martijn Faassen faassen

View GitHub Profile
from graphql.core import graphql
from graphql.core.type import (
GraphQLObjectType,
GraphQLField,
GraphQLArgument,
GraphQLNonNull,
GraphQLSchema,
GraphQLString,
)
@faassen
faassen / morepath_templates.rst
Last active August 29, 2015 14:12
draft of how to integrate template languages into Morepath

Templates

Introduction

You can use the special template argument with the html directive. Here is an example that uses the `Chameleon template engine`_ using the more.chameleon extension:

@faassen
faassen / gist:9211827
Created February 25, 2014 16:02
morepath with werkzeug top 10
ncalls tottime percall cumtime percall filename:lineno(function)
1700000 1.721 0.000 5.101 0.000 lookup.py:136(all)
800000/300000 1.524 0.000 15.923 0.000 mapply.py:5(mapply)
900000/400000 1.038 0.000 18.184 0.000 lookup.py:104(call)
1000000 1.007 0.000 6.388 0.000 lookup.py:54(component)
900000/400000 0.912 0.000 19.195 0.000 generic.py:44(wrapper)
1000000 0.881 0.000 1.171 0.000 compose.py:83(all)
3100002 0.856 0.000 0.856 0.000 {isinstance}
1000000 0.847 0.000 1.464 0.000 generic.py:29(get_lookup)
100000 0.686 0.000 3.557 0.000 wrappers.py:733(__init__)
@faassen
faassen / gist:9211761
Created February 25, 2014 15:58
morepath with wheezy.http top 10
ncalls tottime percall cumtime percall filename:lineno(function)
1700000 1.642 0.000 4.639 0.000 lookup.py:136(all)
800000/300000 1.424 0.000 11.222 0.000 mapply.py:5(mapply)
900000/400000 0.986 0.000 13.368 0.000 lookup.py:104(call)
1000000 0.945 0.000 5.847 0.000 lookup.py:54(component)
900000/400000 0.846 0.000 14.321 0.000 generic.py:44(wrapper)
1000000 0.839 0.000 1.120 0.000 compose.py:83(all)
1000000 0.816 0.000 1.414 0.000 generic.py:29(get_lookup)
100000 0.584 0.000 8.363 0.000 publish.py:18(resolve_model)
200000 0.580 0.000 4.842 0.000 core.py:36(traject_consume)
const WIDTH = 640
const HEIGHT = 400
type
TField = tuple [
a: float,
b: float,
c: float,
d: float,
e: float]
const WIDTH = 640
const HEIGHT = 327
type
TField = tuple [
a: float,
b: float,
c: float,
d: float,
e: float]
const WIDTH = 640
const HEIGHT = 327
type
TField = tuple
a: float
b: float
c: float
d: float
e: float
@faassen
faassen / gist:7945477
Created December 13, 2013 14:56
nimrod noob assignment questions
type
TField = object
height: float
other: float
TRow = array[0..100, TField]
TWorld* = tuple
grid: array[0..100, TRow]
proc init*(world: var TWorld, value: float) =
for row in world.grid: