Skip to content

Instantly share code, notes, and snippets.

@jakubtomsu
jakubtomsu / realtime_collision_detection.odin
Last active March 6, 2026 18:39
Port of some functions from 'Real Time Collision Detection' book by Christer Ericson to Odin
// Port of some collision functions to Odin by Jakub Tomšů.
//
// from Real-Time Collision Detection by Christer Ericson, published by Morgan Kaufmann Publishers, © 2005 Elsevier Inc
//
// This should serve as an reference implementation for common collision queries for games.
// The goal is good numerical robustness, handling edge cases and optimized math equations.
// The code isn't necessarily very optimized.
//
// There are a few cases you don't want to use the procedures below directly, but instead manually inline the math and adapt it to your needs.
// In my experience this method is clearer when writing complex level queries where I need to handle edge cases differently etc.
@sortofsleepy
sortofsleepy / OdinWebAssemblyBasic.md
Last active March 17, 2026 14:10
Odin language simple WebAsembly setup

Have some free time on my hands so I thought I'd try out Odin, an interesting language I came across a few weeks ago. I haven't dived too far into it but so far from what I understand, it's another language in a similar vain of Rust and Zig(both also very good)

Since as far as I can tell, though Odin does support WebAssembly, how specifically to build for it is not well documented so I thought I should post a very basic setup for WebAssembly.

All the Odin app does is

  • export a function that called setup that calls an imported JS function getWindowWidth
  • In the JS, it calls setup and logs the result.

When building the Odin code, the command is roughly odin build -target="js_wasm32" -out=""

@JettIsOnTheNet
JettIsOnTheNet / awesome_lua_cheatsheet.md
Last active February 7, 2026 12:31
Awesome Lua Cheat Sheet

Lua Cheat Sheet

Lua is a lightweight, efficient, and versatile scripting language known for its simplicity and extensibility. It was created by Roberto Ierusalimschy, Waldemar Celes, and Luiz Henrique de Figueiredo at the Pontifical Catholic University of Rio de Janeiro in Brazil in 1993. The name "Lua" translates to "moon" in Portuguese, reflecting the language's intention to be a small and beautiful extension to existing systems. Lua is often used as an embedded scripting language in various applications and has gained popularity in the game development industry for its ease of integration and speed. Its clean and intuitive syntax, along with a powerful set of features, makes Lua a preferred choice for developers seeking a fast and efficient language for their projects.

1. Comments

-- This is a single-line comment

--[[
   This is a multi-line comment
@jroweboy
jroweboy / cc65-toolchain.cmake
Last active January 25, 2026 10:46
CC65 CA65 Toolchain for CMake
# CMake toolchain file for cc65
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR 6502)
# Check for user provided CC65_PATH environment variable
list(APPEND CMAKE_PREFIX_PATH $ENV{CC65_PATH})
find_program(_CL65 cl65)
set(CMAKE_C_COMPILER ${_CL65})
@gpluscb
gpluscb / instant-glicko-2.md
Last active March 19, 2026 06:31
So You Want to Use Glicko-2 for Your Game's Ratings

I wrote this article right after I published the first version of instant-glicko-2. It is meant to document how to implement a Glicko-2 algorithm that allows for instant feedback after games.

So You Want To Use Glicko-2 For Your Game's Ratings

Great! Glicko-2 is a very cool rating system. And a popular choice too! Lichess, CS:GO, and

@gingerBill
gingerBill / sdl2_opengl_demo.odin
Last active February 23, 2026 15:39
Simple SDL2 + OpenGL demo written in Odin
package main
import "core:fmt"
import glm "core:math/linalg/glsl"
import "core:time"
import SDL "vendor:sdl2"
import gl "vendor:OpenGL"
main :: proc() {
@markstrefford
markstrefford / index.html
Created April 30, 2021 19:02
Using videos as textures in three.js
<video id="video" crossorigin="anonymous" style="display: none; position: absolute; left: 15px; top: 75px;"
type="video/mp4"
src="Video-url.mp4" controls="false" autoplay="true">
</video>
@sindresorhus
sindresorhus / esm-package.md
Last active March 20, 2026 07:51
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@simonghales
simonghales / revised.ts
Last active April 22, 2025 08:36
Running a game loop on a web worker
export const createNewPhysicsLoopWebWorker = (stepRate: number) => {
return new Worker('data:application/javascript,' +
encodeURIComponent(`
var start = performance.now();
var updateRate = ${stepRate};
function getNow() {
return start + performance.now();
}
// Hash Functions
//
// murmurHashNM() takes M unsigned integers and returns N hash values.
// The returned values are unsigned integers between 0 and 2^32 - 1.
//
// hashNM() takes M floating point numbers and returns N hash values.
// The returned values are floating point numbers between 0.0 and 1.0.
//------------------------------------------------------------------------------