Skip to content

Instantly share code, notes, and snippets.

View bwindels's full-sized avatar

Bruno Windels bwindels

  • Brest region, France
View GitHub Profile
@bwindels
bwindels / pizza.md
Last active April 12, 2020 21:07
Pizza recipe

Pizza dough recipe

Ingredients

For 1 pizza.

  • 220gr type 00 wheat flour (high protein level, ~11%)
  • 180ml lukewarm tap water
  • half a package of dry yeast (assuming one is for 500g of flour)
  • 3 gr of salt
/* from https://stackoverflow.com/questions/40010597/how-do-i-apply-opacity-to-a-css-color-variable */
:root {
/* #f0f0f0 in decimal RGB */
--color: 240, 240, 240;
}
body {
color: #000;
background-color: #000;
}
function datePart(datetime) {
return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate());
}
function daysFromNextWeekday(weekday, weekdayRef) {
return ((weekdayRef - weekday) + 7) % 7;
}
function amountOfWeekdayInRange(startWeekday, weekdayRef, dayCount) {
const daysToFirstOccurence = daysFromNextWeekday(startWeekday, weekdayRef);
@bwindels
bwindels / updatenightly.sh
Created April 1, 2020 13:47
Script to install latest riot nightly on fedora from deb package
APP_DIR=/opt/Riot\ Nightly/
DESKTOP_FILE=/usr/share/applications/riot-desktop-nightly.desktop
DOC_DIR=/usr/share/doc/riot-desktop-nightly/
ICONS_DIR=/usr/share/icons
REPO_URL=https://packages.riot.im/debian/
FILENAME_LINE=$(curl ${REPO_URL}dists/buster/main/binary-amd64/Packages | grep -oEi 'Filename: (.*nightly.*\.deb)')
PACKAGE_PATH=${FILENAME_LINE:10}
PACKAGE_URL=${REPO_URL}${PACKAGE_PATH}
mkdir tmpriot
@bwindels
bwindels / main.js
Created March 18, 2020 18:08
gjstest
#!/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';
@bwindels
bwindels / test.js
Created January 29, 2020 15:39
use typescript to check javascript types with jsdoc annotations
// check with tsc --allowJs --checkJs --noImplicitAny --noEmit --lib ES2017,dom test.js
/**
* @param {Number} a operand 1
* @param {Number} b operand 2
* @return Promise<Number>
*/
async function add(a, b) {
return a + b;
}
@bwindels
bwindels / structured-logging.js
Last active October 29, 2019 08:34
API idea for structured logging that can be rendered as timeline
// we should consider using descend here to have the same api
// so code doesn't have to care if it deals with the root or not though.
// Although the root wouldn't have any other method... still,
// could be nice to pass in a logitem instead of the root logger object.
const syncLog = loggerRoot.start("sync");
// log level means the whole sync item and subtree will be ignored if so configured,
// unless it has a node that has a higher loglevel.
// Calling `fail` automatically sets the loglevel to WarnLevel for example?
// This way, you can configure the logger to only persist log trees that had a failure in them.

Bring Brawl-like storage to Riot

We could take the approach of gradually taking things over from the sync accumulator. We keep the sync accumulator (and the periodic storing) until the last thing it stores is ported over.

Timeline events

The natural thing to start with would be storing timeline events the way brawl does:

  • have a store for timeline fragments (an area in the timeline where events are only prepended or appended, also storing pagination tokens)
  • have a store for timeline events (linked to a fragment)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
body {
--size: 128px;
--fg-color: blue;
--progress: 0;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
@keyframes spinner {
0% {
transform: rotate(0);
stroke-dasharray: 0 0 10 90;
}