Skip to content

Instantly share code, notes, and snippets.

View marijnh's full-sized avatar

Marijn Haverbeke marijnh

View GitHub Profile
@marijnh
marijnh / keybase.md
Created March 25, 2014 15:11
keybase identity proof

Keybase proof

I hereby claim:

  • I am marijnh on github.
  • I am marijn (https://keybase.io/marijn) on keybase.
  • I have a public key whose fingerprint is 5FCE D776 F73F 8AAA 26C1 6B92 2101 D645 F88A BE15

To claim this, I am signing this object:

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) (format=pdflatex 2014.5.20) 10 JUL 2014 12:08
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**nssample.tex
(./nssample.tex
LaTeX2e <2011/06/27>
Babel <3.9f> and hyphenation patterns for 2 languages loaded.
(./nostarch.cls
Document Class: nostarch 2008/06/06 v1.3 Typesetting books for No Starch Press
@marijnh
marijnh / keybase.md
Created September 18, 2014 22:06
keybase.md

Keybase proof

I hereby claim:

  • I am marijnh on github.
  • I am marijn (https://keybase.io/marijn) on keybase.
  • I have a public key whose fingerprint is ACB6 36D2 3FBF 963B C944 7A2D 703F 1BED 6D33 AE1E

To claim this, I am signing this object:

@marijnh
marijnh / test.html
Created January 30, 2015 22:27
codemirror test
<!doctype html>
<script src="lib/codemirror.js"></script>
<link rel=stylesheet href="lib/codemirror.css">
<style>
.code-wrap {
width: 50%;
border: 2px solid red;
}</style>
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.acorn = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
// The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and
// returns an abstract syntax tree as specified by
@marijnh
marijnh / gist:3658e11554c3f1d891f3
Created May 22, 2015 08:54
Synchronization / collaborative editing algorithm
This is a collaborative editing protocol I came up with. Like OT, it
is change-based, not diff-based. But it is much easier to verify that
clients end up converging, because they all end up applying the
modifications in the same order (so that they _have to converge_, if
they are using the same algorithm).
Clients start with same version + version number
When a client makes a change, that is locally applied and a description
{
"!name": "node_modules/cocos2d/src/global.js",
"!define": {
"String.prototype._observingFunctions.<i>": {
"!span": "4511[148:60]-4552[148:101]"
},
"util.each.!1": {
"!type": "fn(mod: string|?, i: number)",
"!span": "9868[339:27]-10050[342:9]"
},
@marijnh
marijnh / cocos.json
Created July 25, 2015 21:35
cocos.json
{
"!name": "node_modules/cocos2d/src/global.js",
"!define": {
"String.prototype._observingFunctions.<i>": {
"!span": "4511[148:60]-4552[148:101]"
},
"util.each.!1": {
"!type": "fn(mod: string|?, i: number)",
"!span": "9868[339:27]-10050[342:9]"
},
<!doctype html>
<title>CodeMirror: merge view demo</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../doc/docs.css">
<link rel=stylesheet href="../lib/codemirror.css">
<link rel=stylesheet href="../addon/merge/merge.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.14/require.min.js"></script>
<style>
@marijnh
marijnh / parselisp.js
Created November 11, 2010 16:19
Elementary CodeMirror Lisp parser (specialized for AllegroGraph Prolog queries)
// Parses a small subset of Common Lisp as used in AGraph Prolog queries.
LispParser = Editor.Parser = (function() {
function wordRegexp(words) {
return new RegExp("^(?:" + words.join("|") + ")$", "i");
}
var specialForms = wordRegexp(["select", "select-distinct", "select0-distinct", "select0", "<-", "<--"]);
var symbolChars = /[^\s\u00a0\(\)#!<]/;
var tokenizeLisp = (function() {