Skip to content

Instantly share code, notes, and snippets.

@mrange
mrange / main.cpp
Created January 27, 2026 11:16
pimpl
#include "pimpl.h"
int main() {
auto x = new pimpl();
x->the_method();
delete x;
return 0;
}
@mrange
mrange / units.fs
Last active October 7, 2025 19:56
F# measures
open LanguagePrimitives
// Units of measure are *compile-time* type tags on numeric types
// They prevent mixing incompatible dimensions (meters vs seconds) and have *no runtime cost*.
type [<Measure>] m // meter (length)
type [<Measure>] kg // kilogram (mass)
type [<Measure>] s // second (time)
type [<Measure>] A // ampere (electric current)
type [<Measure>] K // kelvin (thermodynamic temperature)
type [<Measure>] mol // mole (amount of substance)
type [<Measure>] cd // candela (luminous intensity)
@mrange
mrange / shadertoy.glsl
Last active September 3, 2025 18:27
Grid glow tracer
// CC0: Grid glow tracer
// Shadertoy compatible
float fbm_noise(vec3 P) {
float
a=.6
, d=0.
, k=0.
;
for(P*=.2;++k<4.;P=P.yzx) {
// Used Dot noise by XorDev as an example.
@mrange
mrange / FuleSnabel.glsl
Created August 18, 2025 20:04
FieldFX 2025-08-18
// -----------------------------------------------------------------------------
#version 430 core
// -----------------------------------------------------------------------------
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform float fFrameTime; // duration of the last frame, in seconds
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
@mrange
mrange / FuleSnabel.glsl
Created August 4, 2025 20:13
Field-FX 2025-08-04
// -----------------------------------------------------------------------------
#version 430 core
// -----------------------------------------------------------------------------
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform float fFrameTime; // duration of the last frame, in seconds
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
@mrange
mrange / FuleSnabel.glsl
Last active July 29, 2025 05:33
Field-FX 2025-07-28
// 2025-07-28 - DJ alkama - 126 BPM
// https://scenesat.com/videoarchive/FYBKI5?bs5#show-FYBKI5
// -----------------------------------------------------------------------------
#version 430 core
// -----------------------------------------------------------------------------
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform float fFrameTime; // duration of the last frame, in seconds
@mrange
mrange / 0_main.glsl
Last active October 6, 2025 17:15
Bonzomatic Prelude
// -----------------------------------------------------------------------------
#version 430 core
// -----------------------------------------------------------------------------
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform float fFrameTime; // duration of the last frame, in seconds
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
@mrange
mrange / program.cs
Last active March 15, 2025 14:06
Spectre
// This software is released into the public domain under the CC0 1.0 Universal license.
//
// You can copy, modify, distribute, and use it for any purpose, without any conditions,
// unless required by law.
//
// To the extent possible under law, the author(s) disclaim all copyright and related
// or neighboring rights to this work.
//
// See: https://creativecommons.org/publicdomain/zero/1.0/
@mrange
mrange / strict.lua
Last active November 24, 2024 14:06
Strict mode in LUA
-- The strict() function helps catch common Lua programming errors
-- by detecting uses of undefined variables. This is helpful because
-- Lua normally creates global variables silently when you mistype
-- a variable name, which can lead to hard-to-find bugs.
function strict()
local declared_globals = {}
-- In Lua, _G is a special table that holds all global variables
-- setmetatable lets us intercept attempts to read or write globals
@mrange
mrange / BINGO1.md
Last active November 12, 2024 16:49
B I N G O
MAUI Enhancements .NET 9 Release Notes ASP.NET Core Updates Improved Performance Blazor WebAssembly
Hot Reload Microservices API Endpoints Machine Learning Cross-platform
Containerized ASP.NET Cloud-Native Microservices Minimal APIs Authentication/Identity
Multithreading ARM64 Support C# 13 Features AI and ML Integration JSON Serialization
WebAssembly Support Project Aspire OpenTelemetry Visual Studio Updates VB Compiler Updates