Skip to content

Instantly share code, notes, and snippets.

View tjstebbing's full-sized avatar
🐝
.go .py .js .vim

Timothy Stebbing tjstebbing

🐝
.go .py .js .vim
View GitHub Profile
@tjstebbing
tjstebbing / HT spec
Last active August 29, 2015 14:04
Concepts for HT
# Hudson Taylor
Hudson Taylor (HT) is a library for building software systems with a Service
Oriented Architecture. It comprises of server library for providing services
with well documented and defined APIs, and a client library for calling
services. All service APIs have Schemas that both document expectations as
well as validate and pre-process incoming data.
HT can be used within a single process to logically partition services from
the beginning. This means that your project has clean internal interfaces and
var data = {
id : "11234141231231245113",
name "Choclate Cake",
tags : [
{id : "123123568674635735", label : "Baking"},
{id : "347457457745745743", label : "Chocolate"}
]
}
var schema = s.Object({
# This is an example Dockerfile with a proposed docker/CI implementation
# built with a simple helper script to trigger build notifications and 
# a few other handy helpers.

FROM ubuntu:trusty

MAINTAINER Pomke <[email protected]>

#Add docker ci
// Watch me get today's Date like a boss..
// In node:
var now = new Date(); // Wed Sep 17 2014 10:51:36 GMT+1000 (EST)
var today = new Date(now.toDateString()); // Wed Sep 17 2014 00:00:00 GMT+1000 (EST)
//Woo! it's still the 17th
//In mongo shell
var now = new Date(); // ISODate("2014-09-17T00:53:28.982Z")
var s = require('ht-schema');
var mfaTypes = ["totp"];
var subSchema = s.Object({
type: s.String({enum: mfaTypes }),
data: s.String({strict: false })
});
var schema = s.Object({
function numberToToken(int) {
return Number('10000'+int).toString(36);
}
function tokenToNumber(token) {
return Number((parseInt(token, 36)+'').slice(4));
}
var num = 123;
var rv = require("rivets");
var fickle = require("fickle");
// Attempt at making a rivets/fickle adapter that remembers keypaths,
// really doesn't work when you start trying to set values :/
function adapt() {
var ctx = fickle.context();
history = {};
var ht = require('hudson-taylor');
var sanitize = require('sanitize-caja');
//XXX This MUST be invoked before any of our libs are loaded, overrides
//ht-schema's String validator.
ht.validators.add("String", makeParser(strParser, null));
function strParser(args, childValidators, data) {
args = merge(args, {min: null, max : null, enum : null, raw : false});
if(!data && !args.opt) throw new Error("required String");
@tjstebbing
tjstebbing / gist:583fc521175bc3b7778e
Created February 4, 2015 21:40
Nouns - Mud parser
You stand in a small meadow outside of Chiiron. To the east, the town walls rise above your head, protecting the inhabitants from the perils which lurk outside the gates. A shallow trickle of a stream flows out of the woods to the northeast, heading off to the southeast. Off to the south, you see a town gate.
Nouns:
TextNode: 'meadow'
TextNode: 'Chiiron'
TextNode: 'town'
TextNode: 'walls'
TextNode: 'rise'
TextNode: 'head'
TextNode: 'inhabitants'
pomke@panda ~ $ /opt/project-neon/bin/krita
###################################
# Adding a tablet device: Wacom Intuos4 8x13 stylus
Device Type: "Stylus"
# Axes limits data
X: 0 65024
Y: 0 40640
Z: 0 0
Pressure: 0 2048
Rotation: -900 899