Skip to content

Instantly share code, notes, and snippets.

View bwindels's full-sized avatar

Bruno Windels bwindels

View GitHub Profile

Bed build

Design

  • cheap wood (calculate cost)
  • possible to (dis)assemble
  • strong
  • high (clean, store guest bed underneath)
  • prettier/better finish than last bed
  • head with storage space
#!/usr/bin/gjs
/*
https://developer.gnome.org/platform-overview/unstable/tour-gjs.html.en
https://gitlab.gnome.org/GNOME/gjs/wikis/Home
examples at https://github.com/optimisme/gjs-examples
docs at https://devdocs.baznga.org/gtk30~3.22.12/
*/
imports.gi.versions.Gtk = '3.0';
const acorn = require("acorn");
const walk = require("acorn-walk");
walk.simple(acorn.parse("const str = this.i18n`foo ${bar} haha`", {sourceType: "module"}), {
// https://github.com/estree/estree/blob/master/es2015.md#template-literals
TaggedTemplateExpression(node) {
console.log("TaggedTemplateExpression:")
console.log(JSON.stringify(node, undefined, 2));
},
ImportDeclaration(node) {
#!/bin/node
const fs = require("fs");
const filename = process.argv[2];
const str = fs.readFileSync(filename, {encoding: "utf8"});
const json = JSON.parse(str);
fs.writeFileSync(filename, json, {encoding: "utf8"});
@bwindels
bwindels / gist:f906029dd174d867964b41225a4c5b8b
Last active March 26, 2021 13:06
Things I learned about web push & notifications
  • after a push message, you always need to have a notification open (could be one that already existed before the push message though), if not the browser will show one with the title "this site has been updated in the background" and tag user_visible_auto_something see https://goo.gl/yqv4Q4.
  • you can't replace notifications, and closing them can cause the issue above, so AFAICT, it's best to just leave notifications open until they are clicked. The above can still happen if you receive a push notification that should not update the notifications after you have clicked the visible one (e.g. for matrix when unread is updated)
  • all browsers I've tested only show the last notification you opened, I think even when self.registration.getNotifications returns more than one.
  • on firefox, chromium on linux and chrome on android, the notification options silent, renotify and requireInteraction didn't seem to have any effect at all.
@bwindels
bwindels / idb-test-webkit-close-txn.html
Created March 4, 2021 17:18
Detect webkit TransactionInactiveError bug
<html>
<head><meta charset="utf-8"></head>
<body>
<script type="text/javascript">
const log = (...params) => {
document.write(params.join(" ")+"<br>");
};
function reqAsPromise(req) {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
body {
margin: 0;
}
.container {
@bwindels
bwindels / download-handler-sandbox.html
Last active October 22, 2020 11:58
Programatically download blob in new origin with one shared hidden iframe
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<p><a id="link" href="#">Download!</a></p>
<script type="text/javascript">
var link = document.getElementById("link");
function download(blob, filename) {
@bwindels
bwindels / idb-promises.html
Last active September 24, 2020 12:17
idb promises
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script type="text/javascript" src="promifill.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script> -->
<script type="text/javascript">
@bwindels
bwindels / README.md
Last active August 7, 2020 08:03
Babel IE11 bundle load failure

SOLVED: The bundle throws an exception on line 270 when loading it in IE11 with it being a symbol. The bundle loads fine in latest Firefox and Chromium, although they probably don't enter the polyfill paths.

SOLUTION (thanks pestdoktor): add exclude: 'node_modules/**' to the rollup babel plugin config, as core-js didn't like being babeled again, and already supports IE8. Like so:

const babelPlugin = babel.babel({
        babelHelpers: 'bundled',
        exclude: 'node_modules/**',
        presets: [
            [
 "@babel/preset-env",