Skip to content

Instantly share code, notes, and snippets.

View TimvanScherpenzeel's full-sized avatar

Tim van Scherpenzeel TimvanScherpenzeel

View GitHub Profile
@TimvanScherpenzeel
TimvanScherpenzeel / Thread.ts
Last active October 14, 2020 12:07
A re-usable thread implementation
// Implementation based on https://github.com/developit/greenlet and https://github.com/developit/task-worklet
class Thread {
private taskId = 0;
private promises: any = {};
private worker: Worker | null = new Worker(
URL.createObjectURL(
new Blob(
[
`(${() => {
@TimvanScherpenzeel
TimvanScherpenzeel / donations.md
Last active October 29, 2020 10:30
Donation addresses

ETH

BTC

import os
import sys
import shutil
import multiprocessing as mp
from itertools import repeat as re
import dateparser
import pytz
import json
import csv
import datetime
@TimvanScherpenzeel
TimvanScherpenzeel / binpack-loader.ts
Created August 16, 2019 09:27
Loading a .binpack file
private loadBinpack = (item: ILoadItem): Promise<any> =>
this.loadArrayBuffer(item).then((data: TVoidable<ArrayBuffer>): any => {
if (data) {
let content = null;
let contentArray = null;
let binaryChunk: TNullable<ArrayBuffer> = null;
let byteOffset = null;
let chunkIndex = 0;
let chunkLength = 0;
let chunkType = null;
@TimvanScherpenzeel
TimvanScherpenzeel / .htaccess
Created May 8, 2019 13:28
Client side routing fix on reload
# BEGIN ROUTING
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
# END ROUTING
// The following defined constants and descriptions are directly ported from https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants.
// Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/.
// Contributors
// https://developer.mozilla.org/en-US/profiles/Sheppy
// https://developer.mozilla.org/en-US/profiles/fscholz
// https://developer.mozilla.org/en-US/profiles/AtiX
// https://developer.mozilla.org/en-US/profiles/Sebastianz
@TimvanScherpenzeel
TimvanScherpenzeel / support-table-gpu-vendor-renderer.md
Last active August 20, 2022 09:12
Support table - GPU vendor & GPU renderer
Device OS OS version Browser Browser version GPU vendor GPU renderer
Apple iPad 5th iOS 11.0.3 Mobile Safari 11.0 Apple Inc. Apple A9 GPU
Apple iPad Air 2 iOS 8.4 Mobile Safari 8.0
Apple iPad Mini 3 iOS 8.1.2 Mobile Safari 8.0
Apple iPad Pro iOS 11.2.1 Mobile Safari 11.0 Apple Inc. Apple A9X GPU
Apple iPhone 5S iOS
@TimvanScherpenzeel
TimvanScherpenzeel / building-COLLADA2GLTF-MacOS-High-Sierra.md
Last active July 17, 2022 19:50
Building instructions for COLLADA2GLTF for MacOS High Sierra Version 10.13.4
# Tested on MacOS High Sierra Version 10.13.4

# Clone Git repo
git clone git@github.com:KhronosGroup/COLLADA2GLTF.git

cd COLLADA2GLTF

# Apple LLVM version 9.1.0 (clang-902.0.39.1) doesn't include 
@TimvanScherpenzeel
TimvanScherpenzeel / index.js
Last active June 14, 2023 12:39
Website scraping using Puppeteer and Node.js
// Native
const fs = require('fs');
const path = require('path');
// Vendor
const { ArgumentParser } = require('argparse');
const fetch = require('node-fetch');
const mkdirp = require('mkdirp');
const puppeteer = require('puppeteer');
@TimvanScherpenzeel
TimvanScherpenzeel / unlock-autoplay-audio-video.md
Last active April 21, 2022 20:30
Implementing audio and video autoplay unlocking

Implementing audio and video autoplay unlocking

Due to recent changes in the autoplay policy of Chrome 66 developers of interactive experiences on the web are facing new challenges regarding audio and video autoplay. The new policy has unfortunately broken many of the older experiences that rely on autoplaying audio and video.

So how to move forward?

Previous solutions

Previously developers used to face this issue on iOS mobile devices where the audio context was locked. Most developers fixed this by using the initial touch event of a user to unlock the audio.