Skip to content

Instantly share code, notes, and snippets.

@moeskerv
moeskerv / color-conversion-algorithms.js
Created January 26, 2021 19:04 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@moeskerv
moeskerv / incidence_friesland.js
Last active February 26, 2021 19:05
Covid Widget für den Kreis Friesland (iOS, braucht App Scriptable), inspiriert durch https://gist.github.com/kevinkub/46caebfebc7e26be63403a7f0587f664
// Licence: Robert Koch-Institut (RKI), dl-de/by-2-0
const newCasesApiUrl = `https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?f=json&where=NeuerFall%20IN(1%2C%20-1)&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22AnzahlFall%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&resultType=standard&cacheHint=true`;
const currentCasesUrl = `https://services9.arcgis.com/NdRIoRRHq1CjkAY8/arcgis/rest/services/Covid19aktuell/FeatureServer/0/query?f=json&where=1%3D1&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&orderByFields=GMD%20asc&outSR=102100&resultOffset=0&resultRecordCount=50&resultType=standard&cacheHint=true`
const incidenceUrl = (today, yesterday) => encodeURI(`https://services9.arcgis.com/NdRIoRRHq1CjkAY8/arcgis/rest/services/Covid19_Inzidenz/FeatureServer/0/query?f=json&where=Datum BETWEEN timestamp '${yesterday}' AND timestamp '$
@moeskerv
moeskerv / incidence_borken.js
Last active November 25, 2020 21:42
Covid19 Widget für den Kreis Borken (iOS, braucht App Scriptable), Inspiriert durch https://gist.github.com/kevinkub/46caebfebc7e26be63403a7f0587f664
// Licence: Robert Koch-Institut (RKI), dl-de/by-2-0
const newCasesApiUrl = `https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_COVID19/FeatureServer/0/query?f=json&where=NeuerFall%20IN(1%2C%20-1)&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22AnzahlFall%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&resultType=standard&cacheHint=true`;
const currentCasesUrl = `https://services2.arcgis.com/297hbk2d6K4DqSw4/arcgis/rest/services/Covid19_AGOL/FeatureServer/1/query?f=json&where=1=1&returnGeometry=false&outFields=INFIZIERTE_AKTUELL_SUM,INFIZIERTE_AKTUELL_SUM_VORTAG,INFIZIERTE,GESUNDETE,VERSTORBENE,STAND,KOMMUNE&orderByFields=DATUM%20desc,KOMMUNE%20asc&resultOffset=0&resultRecordCount=18&resultType=standard&cacheHint=true`
const incidenceUrl = `https://services2.arcgis.com/297hbk2d6K4DqSw4/arcgis/rest/services/Covid19_AGOL/FeatureServer/5/query?f=json&where=1=1&returnGeometry=false&spati