Skip to content

Instantly share code, notes, and snippets.

View PaperclipBadger's full-sized avatar

Blaine Rogers PaperclipBadger

View GitHub Profile
"""
parser_combinators.py
--------------------
Functions that make it easy to create string parsers.
A parser is a function that takes a string ``remaining`` and returns a pair.
If the parser was unsuccessful (the string does not patch the pattern of
characters that that parser accepts), it returns ``(None, remaining)``.
Otherwise, it returns a pair whose first element is the parsing result
"""
svg_path.py
-----------
Provides utility functions for manipulating svgs.
"""
import logging
from parser_combinators import char, white, integer
from parser_combinators import seq, any_, many, one_or_more, change_result
@PaperclipBadger
PaperclipBadger / conjugations.js
Created June 14, 2017 18:27
(some of the) conjugations for Japanese verbs
var conjugations = (function() {
var godan_map =
{ "う": ["わ", "い","う","え","お"]
, "く": ["か", "き","く","け","こ"]
, "ぐ": ["が", "ぎ","ぐ","げ","ご"]
, "す": ["さ", "し","す","せ","そ"]
, "つ": ["た", "ち","つ","て","と"]
, "ぬ": ["な", "に","ぬ","ね","の"]
, "ぶ": ["ば", "び","ぶ","べ","ぼ"]
, "む": ["ま", "み","む","め","も"]
function DummyStore() {
var instance;
return instance =
{ store: {}
, setItem: function (key, val) {
instance.store[key] = val;
return val;
}
, getItem: function (key, def) {
var val = instance.store[key];
{ "mikkel_sigrun_1":
{ "left": "Mikkel"
, "right": "Sigrun"
, "frames":
{ "frame1":
{ "dialogue": "A"
, "speaker":
{ "name": "Mikkel"
, "mood": "Neutral"
}
{
"sender": "[email protected]",
"message_id": 54,
"understanding": {},
"timestamp": 1484439760.0,
"content": "Okay Osh, Grash Has Lelens. _______6____________________ From: Joe Longman <[email protected]> To: Tom Hewlett <tphell Blaine Modesty Rogers and others Ok yeh, no hard to ses >> >>>> >>>> >> >>"
},
{
"sender": "Blaine William Rogers",
"message_id": 0,
@PaperclipBadger
PaperclipBadger / broadcasting.py
Created November 18, 2016 22:07
A demonstration of NumPy's broadcasting semantics.
import numpy as np
a = np.array([[1, 1, 1],
[2, 2, 2],
[3, 3, 3]])
b = np.array([1, 2, 3])
c = np.array([[1],
[2],
[3]])
"""Uses tensorflow to approximate a sin wave with a Gaussian Process"""
from __future__ import print_function
from functools import partial
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import inspect
import numbers
try:
use "promises"
actor Main
new create(env: Env) =>
let promise = Promise[(U64, U64)]
@PaperclipBadger
PaperclipBadger / test.pony
Last active June 24, 2016 16:52
test.pony:13:20: ref method is not a subtype of box method
actor Main
new create(env: Env) =>
Bar()
primitive Foo
fun apply(f: {()}) =>
f()
class Bar
var i: U8 = 0