Skip to content

Instantly share code, notes, and snippets.

@bertspaan
bertspaan / parse_time.py
Created July 5, 2012 14:49
Parser for Dutch natural language time strings
#!/usr/local/Cellar/python3/3.2.3/bin/python3.2
from pypeg2 import *
import datetime
numbers = [
"nul",
"een",
"twee",
"drie",
@bertspaan
bertspaan / parse_time_pyPEG1.5.py
Created July 6, 2012 08:46
Parser for Dutch natural language time strings (Python 2.5, pyPEG 1.5)
import re, fileinput
import pyPEG
from pyPEG import parse, parseLine
from pyPEG import keyword, _and, _not, ignore
import datetime
#pyPEG.print_trace = True
numbers = [
@bertspaan
bertspaan / README.md
Created August 8, 2013 08:36
Animated SVG Spinner using svg:use element

Animated SVG Spinner using svg:use element

Chrome loads external SVG files in an existing SVG element with the svg:use element, but animations do not play...

@bertspaan
bertspaan / index.html
Last active December 20, 2015 22:59
CitySDK: HvA Waiting Time test
<!doctype html>
<head>
<meta charset="utf-8">
<title>HvA - Waiting Time</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<h1></h1>
<p>Add queue length to node <strong>w44508814</strong>:</p>
<table>
@bertspaan
bertspaan / README.md
Last active December 20, 2015 23:48 — forked from mbostock/.block

This example demonstrates how to create a gradient that follows a stroke. This technique is sometimes used to indicate directionality along a curved edge, such as with hierarchical edge bundling.

To start, take any SVG path element and uniformly sample points along the path using getPointAtLength. (This method can also be used for path tweening.) Then, for each segment between adjacent points, compute the miter joint via line-line intersection. Lastly fill each segment by interpolating the start and end colors, here green to red, using the normalized length t along the path. Although each segment is a constant color, there are many segments to give the appearance of a continuous gradient.

This example uses a thin stroke in addition to filling the segments. This avoids antialiasing artifacts due to most

@bertspaan
bertspaan / belemmeringen.geojson
Created August 13, 2013 08:13
Test CORA-data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bertspaan
bertspaan / split_geojson.rb
Last active April 11, 2018 19:52
Ruby script to split GeoJSON file(s) into separate files, one for each feature.
# encoding: UTF-8
require 'json'
require 'fileutils'
ARGV.select{ |file| [".json", ".geojson"].include? File.extname(file) }.each do |file|
basename = File.basename(file, File.extname(file))
geojson = JSON.parse(File.open(file).read)
if geojson.has_key? "features"
@bertspaan
bertspaan / split_geojson.rb
Created August 14, 2013 10:27
Ruby script to split GeoJSON file(s) into separate files, one for each feature.
require 'json'
require 'fileutils'
ARGV.select{ |file| [".json", ".geojson"].include? File.extname(file) }.each do |file|
basename = File.basename(file, File.extname(file))
geojson = JSON.parse(File.open(file).read)
if geojson.has_key? "features"
# Create directory if not exists:
unless Dir.exists?(basename)
@bertspaan
bertspaan / belemmeringen_13.geojson
Created August 14, 2013 12:43
CORA-objecten met overlappende MultiPolygons
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bertspaan
bertspaan / belemmeringen_13.geojson
Created August 14, 2013 12:43
CORA-objecten met overlappende MultiPolygons
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.