Skip to content

Instantly share code, notes, and snippets.

@walling
walling / example1-first-usage.js
Last active June 21, 2017 20:30
blog-post-2017-06-21-examples
var conllu = require('conllu-stream');
var fs = require('fs');
fs.createReadStream('ud-treebanks-v2.0/UD_German/de-ud-train.conllu')
.pipe(conllu())
.on('data', sentence => {
console.log(sentence.features.sent_id, sentence.toString());
});
@walling
walling / async.coffee
Created July 19, 2011 00:23 — forked from tcr/async.coffee
Lean and Mean Serial function in CoffeeScript
# Lean and Mean Serial DSL for CoffeeScript
# (based of https://gist.github.com/1090670 by timcameronryan)
serial = (spec) ->
commands = (func for key, func of spec when key != 'catch')
next = (err, args...) ->
return spec.catch(err) if err
commands.shift().apply(next, args) if commands.length > 0
next null
return
@walling
walling / term2html.js
Created November 19, 2013 10:09
Convert terminal output including ANSI escape sequences to HTML. Only handles simple cases!
'use strict';
var defaultColors = [ '#000', '#D00', '#00CF12', '#C2CB00', '#3100CA',
'#E100C6', '#00CBCB', '#C7C7C7', '#686868', '#FF5959', '#00FF6B',
'#FAFF5C', '#775AFF', '#FF47FE', '#0FF', '#FFF' ];
function term2html(text, options) {
options = options || {};
var colors = options.colors || defaultColors;