Skip to content

Instantly share code, notes, and snippets.

@claudijo
claudijo / asteroids-font-geometries.json
Created May 26, 2022 09:52
Asteroid font as multi-line strings containing x-, y-coordinates. Based on Ed Logg's handwritten notes (see for instance https://twitter.com/atari/status/1475913195814588418)
{
"0": [[[1,-1.5],[-1,-1.5],[-1,1.5],[1,1.5],[1,-1.5]]],
"1": [[[0,-1.5],[0,1.5]]],
"2": [[[1,-1.5],[-1,-1.5],[-1,0],[1,0],[1,1.5],[-1,1.5]]],
"3": [[[-1,-1.5],[1,-1.5],[1,1.5],[-1,1.5]],[[-1,0],[1,0]]],
"4": [[[-1,1.5],[-1,0],[1,0]],[[1,-1.5],[1,1.5]]],
"5": [[[-1,-1.5],[1,-1.5],[1,0],[-1,0],[-1,1.5],[1,1.5]]],
"6": [[[-1,0],[1,0],[1,-1.5],[-1,-1.5],[-1,1.5],[1,1.5]]],
"7": [[[-1,1.5],[1,1.5],[1,-1.5]]],
"8": [[[1,-1.5],[-1,-1.5],[-1,1.5],[1,1.5],[1,-1.5]],[[-1,0],[1,0]]],
@claudijo
claudijo / ulid-utils.js
Created November 29, 2019 12:55
Date from ulid string
// Reference https://github.com/ulid/spec
const alphabet = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
function dateFromUlid(ulid) {
let timestamp = 0;
const decodedTimestamp = ulid.substring(0, 10).toUpperCase();
for (let i = 0; i < decodedTimestamp.length; i++) {
const char = decodedTimestamp.charAt(i);
@claudijo
claudijo / README.md
Last active July 24, 2023 03:52
An Android view for typewriting-like animations

TypewriterView

An Android view that can be used to sequentially animate typing and deleting one character at a time. Pausing and enqueuing arbitrary Runnables is also possible. Inspired by Devunwired @ Stackoverflow (see http://stackoverflow.com/questions/6700374/android-character-by-character-display-text-animation).

An EditText view has been used as base to get a blinking cursor. This has the drawback that the user could edit the text while it is animating. Minimum changes to the code are required to instead use a TextView as base if that is an issue.

Example

TypewriterView typewriterView = (TypewriterView) view.findViewById(R.id.typewriter);
#!/bin/bash
# nodereinstall
# credit: http://stackoverflow.com/a/11178106/2083544
# get sudo
sudo -v
# check to see if npm is installed
IS_NPM_MISSING=$(which npm)
if [[ -z $IS_NPM_MISSING ]]; then