Skip to content

Instantly share code, notes, and snippets.

View oelna's full-sized avatar
😔
The light inside has broken, but I still work

Arno Richter oelna

😔
The light inside has broken, but I still work
View GitHub Profile
@oelna
oelna / graphic.svg
Created January 17, 2020 15:44
SVG with query parameters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This is a crash course in JavaScript. It is intended for people who already have a bit of programming experience in other languages.

This will hopefully give a basic idea of the most-commonly-used language features, but it is not indended to be a comprehensive guide.

This guide was last updated in August 2016.

Basic syntax

To declare a variable called foo:

@oelna
oelna / metatags.html
Last active June 29, 2020 18:29
List of the most common metadata in the HTML head
<!DOCTYPE html>
<html lang="de">
<head>
<!-- Encoding des Dokuments festlegen -->
<meta charset="utf-8" />
<title>Meta und Link Tags</title>
<meta name="description" content="The MDN Web Docs Learning Area aims to provide complete beginners to the Web …" />
<meta name="author" content="Chris Mills" />
<meta name="copyright" content="1998, your name" />
@oelna
oelna / check_website.php
Created March 4, 2020 21:33
Detect when a website changed by logging hashes of the content (eg. check for domain availability)
<?php
/*
Since this script works by detecting changes to the page source code
it works only on static pages. Sites that often change, eg. are generated
by a CMS or embed changing script filenames will always trigger.
There is no easy way around this limitation as far as I know.
Instructions:
- Add your Email and desired URLs
@oelna
oelna / dark-light.css
Created April 2, 2020 16:34
Make elements of a website adapt to iOS/macOS display mode changes automatically
/* define some global values */
:root {
color-scheme: light dark; /* this is required so iOS knows we support display modes at all */
--system-color-blue: rgba(0,122,255,1);
--system-color-green: rgba(52,199,89,1);
--system-color-indigo: rgba(88,86,214,1);
--system-color-orange: rgba(255,149,0,1);
--system-color-pink: rgba(255,45,85,1);
--system-color-purple: rgba(175,82,222,1);
@oelna
oelna / map.html
Last active April 2, 2020 22:14
A simple Mapbox GL JS map with a single marker, suitable for small business websites.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Map</title>
<link rel="stylesheet" href="https://api.mapbox.com/mapbox-gl-js/v1.9.0/mapbox-gl.css" />
<style>
#map-container {
width: 100%;
@oelna
oelna / character.js
Last active April 14, 2020 12:54
A simple hacked-together demo of Javascript modules and classes
const CHARACTER = class {
constructor(name, attributes = {}) {
this.name = name;
this.attributes = {};
// merge custom with default values
Object.assign(this.attributes, {
'strength': 3,
'constitution': 3,
'dexterity': 3,
@oelna
oelna / demo.js
Created April 24, 2020 12:41
Poisson distribution HTML canvas demo
window.addEventListener('DOMContentLoaded', function (event) {
const CANVAS_WIDTH = 1200;
const CANVAS_HEIGHT = 700;
let canvasElement = document.createElement('canvas');
canvasElement.setAttribute('width', CANVAS_WIDTH+'px');
canvasElement.setAttribute('height', CANVAS_HEIGHT+'px');
@oelna
oelna / highscore.html
Last active May 30, 2020 19:06
A very simple Javascript module to keep track of highscores in browser games. Uses localStorage to preserve entries.
<!DOCTYPE html>
<html>
<head>
<title>Highscore Demo</title>
</head>
<body>
<script type="module">
import highscore from './highscore.js'
let points = new highscore('points', 14, 'desc'); /* keep up to 14 scores, under the storage name 'points', sorted in descending order */
@oelna
oelna / file-compression.md
Last active May 29, 2021 13:29
Merkblatt zur Kompression von Bildern, Videos und Audio-Daten

Merkblatt zur Dateikompression

Die Bitrate bestimmt die Qualität des Inhalts. Wird sie größer, steigen Qualität und Speicherbedarf an. Bilddimensionen, bzw. Länge des Musikstücks beeinflussen ebenfalls die Dateigröße: Höhere Auflösung bewirkt in der Regel größeren Platzbedarf.

Übersicht über Formate

Kompression Bild Video Audio
lossy JPG, PNG-8, WEBP, HEIC H.264, H.265, DivX, Xvid, 3GP, MJPEG MP3, AAC, OGG
lossless PNG-24 DV-PAL, PNG FLAC, APE, ALAC, AIFF, WAV