Skip to content

Instantly share code, notes, and snippets.

Avatar

Kris Kowal kriskowal

View GitHub Profile
@kriskowal
kriskowal / kni-markdown-style.md
Last active Dec 12, 2018 — forked from snowyu/kni-markdown-style.md
The new style markdown KNI
View kni-markdown-style.md

Starting with @snowyu’s proposal I infer some design principles:

  1. This language is designed to be easy to render using existing Markdown, YAML, and syntax highlighters.
  2. The language should break out to TypeScript that is evaluated in the scope of a global object that represents all of the play state.
  3. The Markdown script is a Markdown subset that uses inline backtick expressions to break out to an annotation language that carry semantics.
  4. The annotation language embeds the TypeScript grammar for evaluating expressions.

My iteration on this design adds some detail:

  1. We use a Markdown variant that forbids arbitrary HTML, adds semantics to list item notation, and uses backticks for annotations.
@kriskowal
kriskowal / Authors of GG CLA.md
Last active Oct 4, 2018 — forked from CLAassistant/SAP_CLA
Authors of GG Contributor License Agreement
View Authors of GG CLA.md

Authors of GG Individual Contributor License Agreement

Thank you for your interest in contributing to open source software projects (“Projects”) made available by Authors of GG (“Authors”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to Authors in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please

@kriskowal
kriskowal / index.js
Last active Jan 7, 2016 — forked from brianleroux/index.js
callback-with-promise
View index.js
const fs = require('fs')
function readPackage(callback) {
return fs.readFile('./package.json').nodeify(callback);
}
module.exports.readPackage = readPackage
View promise-abort.js
var DIR = '/tmp/test',
FILE_PATTERN = /test/,
fs = require('q-io/fs');
fs.list(DIR)
.then(function (files) {
var matched = files.filter(function (item) {
return item.match(FILE_PATTERN);
});
if (matched.length !== 1) {
View Horses Ponies Wagons and Carts.md

HORSES AND PONIES and WAGONS n CARTS:

By Deb White, Seattle, [NWRinger]

Can horses swim the Brandywine?

The Fellowship of the Ring, 112 the question of whether or not horses can cross the Brandywine River comes up at Buckleberry Ferry. We know that at least 1 hobbit pony can ride the ferry, as Merry takes his across on it when he searches for Frodo who is late to arrive; but there doesn’t seem to be an ability for them, either ponies or horses, to swim it at this point, they must go up to the Bridge or down to Sarn Ford, as Merry’s response to Frodo is: “Can horses cross the river?”

“They can go twenty miles north to Brandywine Bridge - or they might swim,” answered Merry, “Though I never heard of any horse swimming the Brandywine.”

@kriskowal
kriskowal / README.md
Created Aug 23, 2012 — forked from aaronj1335/README.md
bootstrapping mr
We couldn’t find that file to show.
@kriskowal
kriskowal / huffman.py
Created Jul 24, 2012 — forked from ryanwitt/huffman.py
silly huffman coding example
View huffman.py
__all__ = (
'build',
'endode',
'decode',
)
phrase = 'A man a plan a canal Panama'.lower()
def build(phrase):
"""
@kriskowal
kriskowal / streams.js
Created Apr 9, 2012 — forked from domenic/streams.js
Streams are painful
View streams.js
var IO = require("q-io");
function exists(id) {
var deferred = Q.defer();
var request = knoxClient.get(id);
request.on("error", deferred.reject);
request.on("response", function (response) {
if (response.statusCode === 200)
deferred.resolve(IO.Reader(response));
} else {
@kriskowal
kriskowal / streams.js
Created Mar 19, 2012 — forked from domenic/streams.js
Streams are painful
View streams.js
function promiseResponse(request) {
var deferred = Q.defer();
request.on("error", deferred.reject);
request.on("response", deferred.resolve);
return deferred.promise
// if you must:
.fin(function () {
request.removeListener("error", deferred.reject);
request.removeListener("response", deferred.resolve);
});
@kriskowal
kriskowal / spread.js
Created Dec 27, 2011 — forked from mattkime/spread.js
added spread test
View spread.js
"use strict";
var Q = require("../q");
exports['test spread'] = function (ASSERT, done) {
Q.ref([1,2,3])
.spread(function (a, b, c) {
ASSERT.equal(a, 1, 'spread 1');
ASSERT.equal(b, 2, 'spread 2');
ASSERT.equal(c, 3, 'spread 3');
You can’t perform that action at this time.