Skip to content

Instantly share code, notes, and snippets.

View ta2edchimp's full-sized avatar

Andreas Windt ta2edchimp

View GitHub Profile
@ta2edchimp
ta2edchimp / c64-colors.css
Created May 5, 2022 12:33
C64 Color Palette
/* Source: https://twitter.com/codepo8/status/1521074034787733504 */
:root {
--c64black: #000000;
--c64white: #FFFFFF;
--c64red: #68372B;
--c64cyan: #70A4B2;
--c64purple: #6F3D86;
--c64green: #588D43;
--c64blue: #352879;
--c64yellow: #B8C76F;
@ta2edchimp
ta2edchimp / incidence.js
Created October 23, 2020 08:55 — forked from kevinkub/incidence.js
COVID-19 Inzidenz-Widget für iOS innerhalb Deutschlands 🇩🇪
// COVID-19 Inzidenz- und Neuinfizierten Widget
// Licence: Robert Koch-Institut (RKI), dl-de/by-2-0
// Inspired by
// * https://gist.github.com/kevinkub/46caebfebc7e26be63403a7f0587f664
// * https://gist.github.com/oliverandrich/0f34c8d4e6de4b6ff32937c584009a65
// Define URLs based on the corona.rki.de webpage
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,cases7_per_100k&geometry=${location.longitude.toFixed(
// this is a big array of 76 items I need to split into groups of 10
const hugeArray = Array.from({ length: 76 }, (_, i) => i);
function chunkify(array, chunkSize = 10) {
// make a new array
const chunks = Array.from(
// give it however many slots are needed - in our case 8
// 1-7 with 10 items, and 8th slot will have 6
{ length: Math.ceil(array.length / chunkSize) },
// this is a map function that will fill up our slots

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.

@ta2edchimp
ta2edchimp / requestIdleCallback.js
Created March 10, 2016 15:22 — forked from paullewis/requestIdleCallback.js
Shims rIC in case a browser doesn't support it.
/*!
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ta2edchimp
ta2edchimp / os-x-extend-char-selection.md
Last active August 29, 2015 14:16
OS X: Extend »Press And Hold« Character-Selection

Mac OS X: Extend the »Press & Hold« Character Selection

Press and Hold Character Selection

The characters included in the popovers are defined in property lists inside the /System/Library/Input Methods/PressAndHold.app/ bundle.

Add an icelandic eth Ð, ð and thorne Þ, þ to the german standard keyboard layout by editing /System/Library/Input Methods/PressAndHold.app/Contents/Resources/Keyboard-de.plist and logging out and back in.

Roman-Accent-t
/**
* simple JSONP support
*
* JSONP.get('https://api.github.com/gists/1431613', function (data) { console.log(data); });
* JSONP.get('https://api.github.com/gists/1431613', {}, function (data) { console.log(data); });
*
* gist: https://gist.github.com/gists/1431613
*/
var JSONP = (function (document) {
var requests = 0,
@ta2edchimp
ta2edchimp / EVE-ServerStatus.php
Created November 8, 2013 12:08
EVE Online ServerStatus via API, using Pheal (ppetermann/pheal).
<?php
// Pheal.php einbinden
require_once "Pheal/Pheal.php";
// Pheal-Klasse registrieren ...
spl_autoload_register("Pheal::classload");
// Pheal-Klasse instanziieren,
// null, null = kein API-Key (KeyId und vCode) angegeben
// "server" = der Scope, den wir nehmen
$pheal = new Pheal(null, null, "server");
/**
* Kee'nput - a basic shortcut delegation module
* (c) 2010 Andreas Windt aka. ta2edchimp, MIT Style License
* demo temporarily at: http://jsbin.com/axisa3/3
*
* Uses big portions of the basic Listener implementation
* (c) 2010 Andrea Giammarchi, MIT Style License
* see http://webreflection.blogspot.com/2010/05/event-driven-application-and-most-basic.html
* ------------------------------------------------------------------------------------------
* USAGE:
//
// PwdMeter - a simple password strength test
//
// (c) 2009, 2010 Andreas "ta2edchimp" Windt <kontakt@andreaswindt.de> twitter.com/ta2edchimp
// Free to use and modify without limitations. Drop me a line when you use it in a project ;)
//
//
// USAGE:
//
// Requires Prototype JavaScript framework to operate!