Skip to content

Instantly share code, notes, and snippets.

The light inside has broken, but I still work

Arno Richter oelna

The light inside has broken, but I still work
View GitHub Profile

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 / graphic.svg
Created Jan 17, 2020
SVG with query parameters
View graphic.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
oelna / svg-imagemap.html
Last active Apr 24, 2020
A simple example of responsive image maps with HTML and SVG
View svg-imagemap.html
<!DOCTYPE html>
<title>SVG image maps</title>
<!-- -->
<!-- -->
oelna / titles-v1.js
Last active Nov 29, 2019
A simple script to generate pseudo-random titles for an adventure game, a la One Page Dungeon
View titles-v1.js
/* outputs a simple string comprised of strings from a dictionary */
var game = || {};
// inspired by
game.titles = {
'typ': ['Temple', 'Prison', 'House', 'Mansion', 'Dungeon', 'World', 'Castle', 'Graveyard', 'Library', 'Water World'],
'adjektiv': ['Void', 'Blood', 'Burnt', 'Undead', 'Frozen', 'Night'],
'name': ['Queen', 'Prince', 'King', 'Delila']
oelna /
Created Nov 9, 2019
Ways to generate hashes on macOS (BSD)
# shasum
## value of algorithm can be 1, 224, 256, 384, 512
## hash of string
echo -n "foobar" | shasum -a 256
## hash of file content
shasum -a 256 filename.ext
shasum --algorithm 256 /path/filename.ext
oelna /
Created Jun 11, 2019
Hearthstone decklist decode
# modified for brevity from
import base64
from io import BytesIO
from typing import IO, List, Tuple
oelna /
Created Sep 3, 2018
A bash script to batch resize images on macOS, possibly through an Automator Service (uses sips, ImageOptim)
for f in "$@"
dir=$(dirname "${f}")
filename=$(basename -- "$f")
# array of pixel sizes (widths) to generate
sizes=(600 1200)
oelna / applescript.scpt
Created Jun 21, 2018
macOS Automator Action to calculate file hashes
View applescript.scpt
on run {input, parameters}
with timeout of 360 seconds
tell application "System Events"
display dialog input buttons {"OK"} default button 1 with title "File Hashes" giving up after 300 --seconds
end tell
end timeout
end run
oelna / polychromie-architecturale.json
Created Apr 11, 2017
Le Corbusier's "Polychromie Architecturale" – all 63 colors as hex values, with their original name, ID and lightness coefficient (HBW) in a neat JSON array
View polychromie-architecturale.json
"name":"gris foncé 31",
oelna / bingo.php
Last active Mar 5, 2021
A generator for unique Bingo cards in PHP. See in action (generates cards printable on A4 paper size)
View bingo.php
Generate however many unique bingo cards you require (should be fewer than 10k though).
This is not meant to compute ALL possible bingo cards, obviously, but to help set up a
nice amount of cards for play.
If you require a free space somewhere on the board, you should probably tweak the output,
not the generator.
I wrote this because existing solutions on stackoverflow were in languages I could not
test as easily and many existing generator websites generate crap cards that do not
adhere to the bingo number distribution in the 5 rows, so you spend an eternity looking