Skip to content

Instantly share code, notes, and snippets.

View aapoalas's full-sized avatar

Aapo Alasuutari aapoalas

View GitHub Profile
@aapoalas
aapoalas / index.html
Created December 18, 2025 16:42
Minimal proof of concept of a two-axis scrolling grid using CSS subgrids - viewport / virtualisation not included but is mostly trivial to add on top
<html><head></head><body><div style="width: 1000px; height: 1000px; background-color: lightblue; overflow: scroll;"><div style="grid-template-columns: 50px [start] repeat(100, 50px) [end]; grid-template-rows: 24px [start] repeat(100, 24px) [end]; width: 5000px; height: 2400px; display: grid; position: relative;"><div style="display: grid; grid-template-columns: subgrid; grid-template-rows: subgrid; grid-area: start / start / end / end; position: relative;"><div style="background-color: white;">E0</div><div style="background-color: whitesmoke;">E1</div><div style="background-color: white;">E2</div><div style="background-color: whitesmoke;">E3</div><div style="background-color: white;">E4</div><div style="background-color: whitesmoke;">E5</div><div style="background-color: white;">E6</div><div style="background-color: whitesmoke;">E7</div><div style="background-color: white;">E8</div><div style="background-color: whitesmoke;">E9</div><div style="background-color: white;">E10</div><div style="background-color: w
@aapoalas
aapoalas / mod.rs
Last active August 11, 2024 14:13
Rust GC lifetime management
/// Some "heap memory arena" of sorts. It holds within it
/// vectors of things. "Referencing" into the arena is done
/// using Value structs.
struct Arena {
data: AtomicUsize,
}
/// A calling context where garbage collection can happen.
struct GcContext<'gc> {
marker: PhantomData<&'gc mut ()>,
arena: *const Arena,
@aapoalas
aapoalas / importViaScript.mjs
Last active August 24, 2019 03:38
ECMAScript dynamic import without CSP violation errors
export default url => new Promise((res, rej) => {
const script = document.createElement("script");
script.src = url;
script.type = "module";
const onload = () => {
script.remove();
res(import(url));
};
const onerror = error => {
script.remove();
@aapoalas
aapoalas / Reparentable.jsx
Last active July 9, 2018 20:06
React Component supporting reparenting through a manual DOM hack. Presume MIT licence.
define([
"react",
"react-dom",
"prop-types"
], function(
React,
ReactDOM,
PropTypes
) {
"use strict";