Skip to content

Instantly share code, notes, and snippets.

@bvdaakster
bvdaakster / main.js
Created June 11, 2023 17:49
Javascript Base64 to Uint8Array in browser
// from: https://stackoverflow.com/a/66046176
async function base64EncodeU8(data) {
const base64url = await new Promise(r => {
const reader = new FileReader();
reader.onload = () => r(reader.result);
reader.readAsDataURL(new Blob([data]));
})
return base64url.substring(base64url.indexOf(',') + 1);
}
@bvdaakster
bvdaakster / get_static_props.php
Last active September 8, 2020 16:07
PHP get_static_props
<?php
class A {
static $a = 1;
public $b = 2;
private $c = 3;
}
function get_static_props($class) {
return array_filter(array_keys(get_class_vars($class)), function ($i) use ($class) {