Skip to content

Instantly share code, notes, and snippets.

Mark Tiedemann MarkTiedemann

Block or report user

Report or block MarkTiedemann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View little_endian.js
let isLittleEndian = new Uint8Array(new Uint16Array([0x1234]).buffer)[0] === 0x34;
@MarkTiedemann
MarkTiedemann / cdc.ts
Last active Jan 27, 2020
Latest 10-minute air temperatures for Hamburg-Neuwiedenthal by Climate Data Center Germany
View cdc.ts
// Usage: deno --allow-net cdc.ts
import "https://raw.githubusercontent.com/Stuk/jszip/v3.2.1/dist/jszip.min.js";
import { parse } from "https://deno.land/std@v0.31.0/encoding/csv.ts";
import { BufReader } from "https://deno.land/std@v0.31.0/io/bufio.ts";
main();
async function main() {
// For a list of stations, see: https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/10_minutes/air_temperature/now/zehn_now_tu_Beschreibung_Stationen.txt
View dwd.js
const fs = require("fs");
const https = require("https");
const jsdom = require("jsdom");
const unzipper = require("unzipper");
main();
function main() {
// To get an overview, see:
// https://www.dwd.de/DE/leistungen/met_verfahren_mosmix/met_verfahren_mosmix.html
@MarkTiedemann
MarkTiedemann / index.html
Last active Jan 10, 2020
Single Sentence DOMParser, XSLTProcessor, and XMLSerializer Tutorial
View index.html
<!DOCTYPE html>
<title>Single Sentence DOMParser, XSLTProcessor, and XMLSerializer Tutorial</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
html {
font-family: Arial;
background: #20202a;
color: white;
margin: 0 1em;
padding-bottom: 2em;
@MarkTiedemann
MarkTiedemann / Makefile
Created Dec 13, 2019
the-lost-art-of-the-makefile/01-your-tests-dont-need-to-be-phony/07
View Makefile
.PHONY: clean
clean:
-rm *.tested
@MarkTiedemann
MarkTiedemann / Makefile
Created Dec 13, 2019
the-lost-art-of-the-makefile/01-your-tests-dont-need-to-be-phony/06
View Makefile
.PHONY: test
test: good.tested bad.tested
good.tested: ndjson_validator.js good.ndjson
node ndjson_validator.js < good.ndjson
touch good.tested
bad.tested: ndjson_validator.js bad.ndjson
! node ndjson_validator.js < bad.ndjson
touch bad.tested
@MarkTiedemann
MarkTiedemann / Makefile
Created Dec 13, 2019
the-lost-art-of-the-makefile/01-your-tests-dont-need-to-be-phony/05
View Makefile
.PHONY: test
test:
node ndjson_validator.js < good.ndjson
! node ndjson_validator.js < bad.ndjson
@MarkTiedemann
MarkTiedemann / bad.ndjson
Created Dec 13, 2019
the-lost-art-of-the-makefile/01-your-tests-dont-need-to-be-phony/04
View bad.ndjson
This is invalid NDJSON.
@MarkTiedemann
MarkTiedemann / good.ndjson
Created Dec 13, 2019
the-lost-art-of-the-makefile/01-your-tests-dont-need-to-be-phony/03
View good.ndjson
[ "This", "is", "valid", "NDJSON." ]
@MarkTiedemann
MarkTiedemann / ndjson_validator.js
Created Dec 13, 2019
the-lost-art-of-the-makefile/01-your-tests-dont-need-to-be-phony/02
View ndjson_validator.js
// Usage: node ndjson_validator.js < file
require("readline")
.createInterface(process.stdin)
.on("line", line => {
try { JSON.parse(line) }
catch { process.exit(1) }
})
You can’t perform that action at this time.