Skip to content

Instantly share code, notes, and snippets.

View thetarnav's full-sized avatar
🌲
walking trees of green

Damian Tarnawski thetarnav

🌲
walking trees of green
  • Wrocław, Poland
  • 20:41 (UTC +01:00)
  • X @thetarnav
View GitHub Profile
@thetarnav
thetarnav / readme.md
Last active September 5, 2025 19:12
odin SDL_shadercross bindings
@thetarnav
thetarnav / a_star.odin
Last active July 23, 2024 21:29
A* Path Finding Algorithm in Odin
package game
import "core:slice"
import "../grid"
astar :: proc (
path: ^[dynamic]grid.Coord,
grid_walls: grid.Grid(bool),
@thetarnav
thetarnav / bitap_search.js
Last active May 22, 2024 14:12
Fuzzy Search JS
const MAX_UNICODE = 1114111
let bit_array = new Int32Array(MAX_UNICODE).fill(~0)
/**
* This algorithm determines if a given short string exists in a larger string with k errors.
* It's useful for search-as-you-type features.
*
* @param {string} text
* @param {string} pattern
* @returns -1 when not found, otherwise the index of the first occurrence of the pattern in the text
@thetarnav
thetarnav / odin_setup.md
Created April 18, 2024 16:37
Setting up Odin on Windows
@thetarnav
thetarnav / odin_build.js
Created March 31, 2024 16:14
Node.js script for building Odin
import * as child_process from "node:child_process"
/**
* @enum {(typeof Optimization_Mode)[keyof typeof Optimization_Mode]} */
export const Optimization_Mode = /** @type {const} */({
None : "none",
Minimal : "minimal",
Size : "size",
Speed : "speed",
Aggressive: "aggressive",
@thetarnav
thetarnav / isatty.odin
Last active March 28, 2024 15:28
isatty in odin
when ODIN_OS == .Windows {
is_terminal :: proc(fd: os.Handle) -> bool {
return false
}
} else {
foreign import libc "system:c"
foreign libc {
@(link_name = "isatty")
_isatty :: proc(fd: os.Handle) -> b32 ---
@thetarnav
thetarnav / res.tsx
Created March 25, 2024 11:14
solid cached resource
import { render } from "solid-js/web";
import * as s from "solid-js";
enum Query_State {
Loading,
Cached,
Loaded,
}
class Query_Resource<T> {
@thetarnav
thetarnav / jsconfig.json
Last active February 5, 2024 09:48
tsconfig.json
{
"compilerOptions": {
/*
Solves "Cannot write file '.../.js' because it would overwrite input file."
*/
"outDir": "types",
"allowJs": true,
"checkJs": true,
"skipLibCheck": false,
"maxNodeModuleJsDepth": 1,
@thetarnav
thetarnav / expect_type.ts
Last active January 30, 2024 18:12
expect type helper
/*
From TypeStrong/ts-expect
MIT License
https://github.com/TypeStrong/ts-expect/blob/master/src/index.ts
*/
/**
* Checks that `Subtype` is assignable to `Type`.
*
* ```ts
@thetarnav
thetarnav / nocheckin.md
Created January 27, 2024 12:03
nocheckin

John Blow has a commit hook that prevents him from commiting nocheckin

hook

echo "" && git grep --cached --line-number "nocheckin" && echo "FOUND nocheckin" && exit 1
exit 0

to add it