Skip to content

Instantly share code, notes, and snippets.

Avatar
😄

Martin Harder martinharder

😄
  • Berlin, Germany
View GitHub Profile
@martinharder
martinharder / age.js
Last active Nov 4, 2020
Wie alt bin ich heute, wie alt ist mein... Ein Widget für Scriptable. // How old am I today? How old is my... A widget for Scriptable.
View age.js
// Deutsche Version
const params = args.widgetParameter ? args.widgetParameter.split(',') : null;
const dateString = params && params.length > 0 ? params[0].trim() : null;
const name = params && params.length === 2 ? params[1].trim() : null;
function calculateDateValues(dateString) {
const dob = new Date(dateString);
const now = new Date(Date.now());
const totalDays = daysBetween(dob, now);
@martinharder
martinharder / incidence.js
Last active Nov 22, 2020 — forked from kevinkub/incidence.js
COVID-19 Inzidenz-Widget für iOS innerhalb Deutschlands 🇩🇪
View incidence.js
// 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 incidenceUrl = (location) => `https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?where=1%3D1&outFields=GEN,last_update,cases,cases7_per_100k&geometry=${location.longitude.toFixed(3)}%2C${location.latitude.toFixed(3)}&geometryType=esriGeometryPoint&inSR=4326&spatialRel=esriSpatialRelWithin&returnGeometry=false&outSR=4326&f=json`
const saveIncidenceLatLon = (location) => {
let fm = FileManager.iCloud()
let path = fm.joinPath(fm.documentsDirectory(), "covid19latlon.json")
fm.w
You can’t perform that action at this time.