Skip to content

Instantly share code, notes, and snippets.

View bwindels's full-sized avatar

Bruno Windels bwindels

View GitHub Profile
@bwindels
bwindels / index.html
Created April 8, 2022 15:43
Sample project how to load theme at dev time
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<script type="module">
import "@theme/default";
</script>
</head>
@bwindels
bwindels / foo.css
Last active April 8, 2022 09:30
attempt at vite virtual css modules
body {
color: red;
}
class IconSerializer {
toURL(iconData: string, path: string): string {
// for build-time, we emit an asset with iconData and a name derived from path
// for run-time, we return a base64 data url of iconData
return "";
}
}
class Icon {
constructor(
async function expandAll() {
const nonShownLargeDiffExpanders = Array.from(document.querySelectorAll(".load-diff-button"));
for (const e of nonShownLargeDiffExpanders) {
e.click();
}
await new Promise(r => setTimeout(r, 200));
let expanders;
do {
expanders = Array.from(document.querySelectorAll(".js-expand"));
for (const e of expanders) {
@bwindels
bwindels / expand-gh-comments.js
Created December 15, 2021 15:00
Expand all github comments on a PR
Array.from(document.querySelectorAll(".ajax-pagination-btn")).forEach(b => b.click())
// wait a bit for everything to load
Array.from(document.querySelectorAll(".Details-content--closed")).forEach(e => e.click())
@bwindels
bwindels / timeline-scrollby.html
Last active September 2, 2021 15:00
timeline-scrollby.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
body {
padding: 10px;
margin: 0;
display: flex;
flex-direction: column;
#!/usr/bin/gjs
imports.gi.versions.Gtk = '4.0';
const Gtk = imports.gi.Gtk;
const Gio = imports.gi.Gio;
const Mainloop = imports.mainloop;
const GObject = imports.gi.GObject;
const RoomTileViewModel = GObject.registerClass({
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
#route {
fill:none;
stroke:green;
stroke-width:4px;
stroke-linecap:butt;
stroke-linejoin:miter;
trait Parser<'a> {
	type Input;
	type Output;
	type Error;

	fn parse(&self, input: &mut 'a Self::Input) -> Result<ParsedValue<'a>, Self::Error>;
}

enum ParsedValue&lt;'a&gt; {
//run with: for file in ~/Downloads/bikeblog/*.html; do node index.js "$file" ~/dev/nonwork/bikeblog/bikeblog/content/; done
const cheerio = require("cheerio");
const slug = require("slug");
const fs = require("fs");
const {execSync} = require("child_process");
const path = require("path");
const file = process.argv[2];
const targetbasedir = process.argv[3];
const dir = path.dirname(file);
console.log(file, targetbasedir);