Skip to content

Instantly share code, notes, and snippets.

View WebReflection's full-sized avatar
🎯
Focusing

Andrea Giammarchi WebReflection

🎯
Focusing
View GitHub Profile
@WebReflection
WebReflection / gnome.md
Last active February 5, 2025 19:16
Minimal GNOME Setup for ArchLinux

This is a personal reminder about few things I need to remember wheneve I install the most basic Gnome on ArchLinux.

Minimal Installation

bash <(curl -s https://archibold.io/install/gnome)

This will install automatically pamac-aur, Firefox, and many other common software so that the rest of this document could be ignore.

@WebReflection
WebReflection / debian-on-windows.md
Last active March 29, 2020 05:24
Debian on Windows

Enable WSL

Search for Turn Windows features on or off and enable Windows Subsytem for Linux

Install Debian from Windows Store

Go to Windows Store and seach for Linux Debian

Install from it, and configure it for the first time.

@WebReflection
WebReflection / esm-in-nodejs.md
Last active October 20, 2021 14:54
Solving the "ESM in NodeJS" Odyssey.

Solving the "ESM in NodeJS" Odyssey.

After months of discussions in a dedicated group, it's clear to me NodeJS is still stuck in finding a way to deliver native ESM to its users.

The "usual few" won't hear anything different from .mjs, but .mjs has been demonstrated to be not a solution neither.

Following few cases not covered by .mjs:

  • evaluation of any string, via CLI, or on demand, where there is no extension
  • tools that convert their syntax into JS, since it always worked to date (thanks to transpilers, bundlers, and loaders)
@WebReflection
WebReflection / proxy.js
Created May 22, 2018 14:42
A proxy with a handler.proxy always available.
const proxy = (target, handler) => {
handler = typeof handler === 'object' ?
Object.create(handler) : new handler;
return (handler.proxy = new Proxy(target, handler));
};
@WebReflection
WebReflection / Promise.listeners.js
Last active April 24, 2018 14:21
Bringing addListeners and removeListeners to Promises.
(function (wm) {'use strict';
// original proposal via Oliver Dunk @oliverdunk_ via ES ML
// (c) Andrea Giammarchi - (ISC)
Object.defineProperties(
Promise.prototype,
{
addListeners: {
configurable: true,
value: function addListeners(resolve, reject) {
var once = wm.get(this);
@WebReflection
WebReflection / proto-classic.js
Created April 4, 2018 08:03
Benchmark for prototypal VS classic state management
const bench = {
stress: 10e2,
times: 5,
classical(copy, overwrite) {
this._prototype = false;
this._bootstrap(copy, overwrite);
},
prototypal(copy, overwrite) {
this._prototype = true;
this._bootstrap(copy, overwrite);

A list of screen shots for browsers capabilities

<!doctype html>
<html>
<head>
<script>
class Logger extends HTMLElement {
connectedCallback() {
console.log(`<${
this.nodeName.toLowerCase()
}> has ${
// now an npm package qith 100% code coverage:
// https://github.com/WebReflection/endow#endow---
// (c) Andrea Giammarchi, @WebReflection (ISC)
const mix = Super => ({
with: (...mixins) =>
mixins.reduce(
(Class, Mixin) => {
Class = Mixin(Class);
if (!Mixin.hasOwnProperty(Symbol.hasInstance)) {
@WebReflection
WebReflection / fsb.js
Last active July 7, 2023 12:52
Full Screen WebKitGTK via GJS Browser
#!/usr/bin/env gjs
// (c) Andrea Giammarchi - ISC
// define the Gtk version to use (July 2023)
imports.gi.versions.Gtk = '3.0';
imports.gi.versions.WebKit2 = '4.1';
const GLib = imports.gi.GLib;
GLib.setenv('JSC_useSharedArrayBuffer', 'true', true);