A simple SVG-based radar or spider chart for mithril without any external dependencies, based on the source code found here.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create a GUID | |
* @see https://stackoverflow.com/a/2117523/319711 | |
* | |
* @returns RFC4122 version 4 compliant GUID | |
*/ | |
export const uuid4 = () => { | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { | |
// tslint:disable-next-line:no-bitwise | |
const r = (Math.random() * 16) | 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type ICallback<T> = (data: T, envelope: IEnvelope<T>) => void; | |
/** Message enveloppe */ | |
export interface IEnvelope<T> { | |
/* Uses DEFAULT_CHANNEL if no channel is provided */ | |
channel?: string; | |
/** Topic name */ | |
topic: string; | |
/** Payload */ | |
data?: T; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create a GUID | |
* @see https://stackoverflow.com/a/2117523/319711 | |
* | |
* @returns RFC4122 version 4 compliant GUID | |
*/ | |
export const uuid4 = () => { | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { | |
// tslint:disable-next-line:no-bitwise | |
const r = (Math.random() * 16) | 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ColorExt; | |
(function (ColorExt) { | |
var Utils = (function () { | |
function Utils() { | |
} | |
Utils.hsv2rgb = function (h, s, v) { | |
var rgb, i, data = []; | |
if (s === 0) { | |
rgb = [v, v, v]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const copyToClipboard = str => { | |
const el = document.createElement('textarea'); | |
el.value = str; | |
el.setAttribute('readonly', ''); | |
el.style.position = 'absolute'; | |
el.style.left = '-9999px'; | |
document.body.appendChild(el); | |
const selected = | |
document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false; | |
el.select(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>PDOK achtergrondkaarten</title> | |
<!-- https://www.pdok.nl/introductie/-/article/basisregistratie-topografie-achtergrondkaarten-brt-a- | |
Zie ook de wizard hier: | |
https://nlmaps.nl/ | |
PDOK biedt 4 base maps aan van NL: standaard, grijs, water, en pastel. Deze kun je gratis gebruiken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const capitalize = (s: string) => s.charAt(0).toUpperCase() + s.slice(1); | |
/** Capitalize first names that are derived from an email, like anne_merel or jan_willem. */ | |
export const capitalizeName = (s: string) => | |
/^ij/i.test(s) // names like IJsbrand | |
? s.replace(/^ij/i, 'IJ') | |
: /_/.test(s) // names like jan_willem | |
? s.split('_').map(capitalize).join('-') | |
: capitalize(s); // other names |
Error: listen EADDRINUSE: address already in use :::1234
When node.js complains that an address is in use, this may happen because the service did not end properly. In order to kill the hanging process, do the following in an Admin PowerShell window:
netstat -ano|findstr "PID :1234"
I had a CSV file that needed to be processed on a web page. So I had to convert the Excel time to UTC time.
According to this answer on StackOverflow:
The Excel number for a modern date is most easily calculated as the number of days since 12/30/1899 on the Gregorian calendar.
Excel treats the mythical date 01/00/1900 (i.e., 12/31/1899) as corresponding to 0, and incorrectly treats year 1900 as a leap year. So for dates before 03/01/1900, the Excel number is effectively the number of days after 12/31/1899.