Skip to content

Instantly share code, notes, and snippets.

View folkertdev's full-sized avatar

Folkert de Vries folkertdev

View GitHub Profile
@hoelzro
hoelzro / add-missing-types.vim
Created February 15, 2017 16:17
Vimscript to add missing types to an Elm program
function! s:GetReport(filename)
" XXX async would be better
let lines = systemlist("elm-make --report=json " . a:filename)
let lines = lines[0:-2] " strip off last line, which isn't JSON
return json_decode(join(lines, '\n'))
endfunction
function! s:ExtractAnnotations(report)
let annotations = []
for item in a:report
@Slater-Victoroff
Slater-Victoroff / PyMarkov
Last active March 28, 2022 13:55
Arbitrary ply markov constructor in python
from collections import Counter
import cPickle as pickle
import random
import itertools
import string
def words(entry):
return [word.lower().decode('ascii', 'ignore') for word in entry.split()]
def letters(entry):
@klaftertief
klaftertief / reactiveconf-2016-lightning-talk.md
Last active April 2, 2024 20:17
An API search engine in Elm for Elm, proposal for a Lightning Talk at ReactiveConf 2016

An API search engine in Elm for Elm

Elm is a statically typed functional language that compiles to JavaScript. It's well-known for its developer experience: the compiler provides nice error messages, the package system enforces semantic versioning for all published packages and makes sure every exposed value or type has some documentation and type annotations.

@kprotty
kprotty / lz4_block.zig
Last active July 20, 2026 00:53
Simple LZ4 block enc/dec in 100 LOC
const std = @import("std");
fn writeExtended(w: *std.Io.Writer, value: u32) !void {
const num_max_bytes = value / 0xff;
try w.splatByteAll(0xff, num_max_bytes);
try w.writeByte(@intCast(value - (num_max_bytes * 0xff)));
}
fn readExtended(r: *std.Io.Reader) !u32 {
var value: u32 = 0;
@max-mapper
max-mapper / bibtex.png
Last active September 9, 2026 17:52
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png