Skip to content

Instantly share code, notes, and snippets.

View thygrrr's full-sized avatar
infinite loop

tiger tiger tiger thygrrr

infinite loop
View GitHub Profile
@thygrrr
thygrrr / Damp.cs
Last active November 6, 2024 10:07
C# Damping for Godot et al
//SPDX-License-Identifier: MIT
using System.Runtime.CompilerServices;
using Godot;
using Vector3 = System.Numerics.Vector3;
namespace Jovian.Math
{
public static class Damp
{
@thygrrr
thygrrr / CollectionsBenchmarks.cs
Last active November 6, 2024 08:27
.NET Benchmark of Frozen, Immutable, and normal Generic Collections
// SPDX-License-Identifier: Unlicense
// Inspired by https://okyrylchuk.dev/blog/when-to-use-frozen-collections-in-dotnet/
using System.Collections.Frozen;
using System.Collections.Immutable;
using BenchmarkDotNet.Attributes;
namespace Benchmark.Conceptual;
[ShortRunJob]
@thygrrr
thygrrr / MultipleSignals.gd
Last active April 13, 2025 10:04
Awaiting multiple Signals in Godot 4.4
# SPDX-License-Identifier: Unlicense
extends Control
# Awaits until any one of the provided array of signals was emitted, and returns that signal
func any(signals : Array[Signal]) -> Signal:
var emitted : Array[Signal] = []
var lambdas : Array[Callable] = []
for sig in signals:
var lambda := func():