Skip to content

Instantly share code, notes, and snippets.

View makryl's full-sized avatar

Maksim Krylosov makryl

View GitHub Profile
@makryl
makryl / emscripten_localStorage_fs.js
Last active April 15, 2021 00:32
Synchronous LocalStorage file system for Emscripten
var Module = {
// ...
preInit: [
function() {
// create LSFS and mount 'data' local storage item into '/data' directory
FS.mkdir('/data'); // for old versions use: FS.createFolder(FS.root, 'data', true, true);
FS.mount(LSFS(), { key: 'data' }, '/data');
}
]
};
@adriengibrat
adriengibrat / l.php
Last active January 22, 2024 14:45
Extreme minification of shortest possible PSR-0 compliant autoloader, 5 lines !
<?php
//set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__); // optional
spl_autoload_register(function ($class) {
$file = preg_replace('#\\\|_(?!.+\\\)#','/', $class) . '.php';
if (stream_resolve_include_path($file))
require $file;
});