Skip to content

Instantly share code, notes, and snippets.

@mccutchen
mccutchen / .envrc
Last active January 30, 2025 14:48
Example direnv .envrc for Python projects that manages a local virtualenv that updates automatically when requirements.txt changes
#!/bin/bash
set -euo pipefail
VIRTUAL_ENV=".venv"
REQUIREMENTS_HASH_FILE="$VIRTUAL_ENV/requirements.shasum"
REQUIREMENTS_HASH_FUNC="shasum"
REQUIREMENTS_HASH_VAL=$($REQUIREMENTS_HASH_FUNC requirements.txt | cut -d ' ' -f 1)
function reset_venv() {
if ! has uv; then
@artokun
artokun / Hierarchy.txt
Last active June 7, 2025 09:38
Godot 4 3D RTS Camera Controller
World (Node3D)
|- RTSController (Node3D)
|- Elevation (Node3D)
|- MainCamera (Camera3D)
@raohmaru
raohmaru / requestAnimationFrame.js
Last active June 23, 2025 21:34
requestAnimationFrame() in node.js
const callbacks = [];
const fpsInterval = 1000 / 60;
let time = performance.now();
function requestAnimationFrameLoop() {
const now = performance.now();
const delta = now - time;
if (delta >= fpsInterval) {
// Adjust next execution time in case this loop took longer to execute
time = now - (delta % fpsInterval);
@Meshiest
Meshiest / godot multiplayer.md
Last active September 7, 2025 20:13
Godot 4 Multiplayer Overview

Godot 4 Scene Multiplayer

I'm too lazy to write this as official documentation so I'm transcribing my experiences here for reference.

This is high level and does not cover how to setup your peer, only how to use the API itself.

This is not a tutorial.

If you are just getting started, this tutorial by DevLogLogan is worth watching.

@samfromcadott
samfromcadott / raylib-bullet.cc
Created June 11, 2023 16:10
Example of using Bullet Physics with raylib
// raylib+Bullet physics
// Sam Jackson
// Partially based off this: https://github.com/bulletphysics/bullet3/blob/master/examples/HelloWorld/HelloWorld.cpp
#include <vector>
#include <btBulletDynamicsCommon.h>
#include <raylib.h>
btDefaultCollisionConfiguration* collision_configuration;
@sumofat
sumofat / collision_3d.odin
Created August 19, 2023 15:21 — forked from jakubtomsu/collision_3d.odin
Simple raylib example of 3d FPS player movement with triangle collision
package main
import "core:fmt"
import "core:math"
import "core:math/linalg"
import rl "vendor:raylib"
main :: proc() {
rl.SetConfigFlags({.VSYNC_HINT, .WINDOW_RESIZABLE, .MSAA_4X_HINT})
rl.InitWindow(800, 600, "collision")
@GuvaCode
GuvaCode / collision_3d.odin
Created August 22, 2023 17:39 — forked from jakubtomsu/collision_3d.odin
Simple raylib example of 3d FPS player movement with triangle collision
package main
import "core:fmt"
import "core:math"
import "core:math/linalg"
import rl "vendor:raylib"
main :: proc() {
rl.SetConfigFlags({.VSYNC_HINT, .WINDOW_RESIZABLE, .MSAA_4X_HINT})
rl.InitWindow(800, 600, "collision")

From Zigling 058.

//                          u8  single item
//                         *u8  single-item pointer
//                        []u8  slice (size known at runtime)
//                       [5]u8  array of 5 u8s
//                       [*]u8  many-item pointer (zero or more)
//                 enum {a, b}  set of unique values a and b
//                error {e, f}  set of unique error values e and f
@erikyuzwa
erikyuzwa / CMakeLists.txt
Last active December 27, 2025 00:57
CMakeLists.txt for SDL3 projects
# CMakeLists.txt project file for SDL3 projects
#
# NB: SDL_image, SDL_ttf and SDL_mixer are not yet tagged properly
# in github to be included via this fetch mechanism.
# As they are updated, I will endevour to keep this gist updated
cmake_minimum_required(VERSION 3.30)
project(hello_sdl3_with_cmake C)
set(CMAKE_C_STANDARD 23)
#version 300 es
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
out vec4 fragColor;
uniform vec2 resolution;
uniform vec3 orientation;