Skip to content

Instantly share code, notes, and snippets.

@nicebyte
nicebyte / dyn_arr.h
Last active February 25, 2025 10:29
dyn_arr
#pragma once
#define DYN_ARR_OF(type) struct { \
type *data; \
type *endptr; \
uint32_t capacity; \
}
#if !defined(__cplusplus)
#define decltype(x) void*
@vurtun
vurtun / _GJK.md
Last active August 23, 2025 22:02
3D Gilbert–Johnson–Keerthi (GJK) distance algorithm

Gilbert–Johnson–Keerthi (GJK) 3D distance algorithm

The Gilbert–Johnson–Keerthi (GJK) distance algorithm is a method of determining the minimum distance between two convex sets. The algorithm's stability, speed which operates in near-constant time, and small storage footprint make it popular for realtime collision detection.

Unlike many other distance algorithms, it has no requirments on geometry data to be stored in any specific format, but instead relies solely on a support function to iteratively generate closer simplices to the correct answer using the Minkowski sum (CSO) of two convex shapes.

/* ===========================================================================
*
* LIBRARY
*
* =========================================================================== */
/* Proof of Concept GUI:
* - PoC UI implementation in ~2.5kLOC of C89 (ANSI C)
* => Core solutions has no external dependencies (removing standard library dependency is trival)
* => Does not use or require any special language constructs or macro constructs just pointers and enums
* - Combines both "retained" and "immediate mode" UI by providing control over update frequency
@djg
djg / reading-list.md
Last active March 21, 2025 08:41
Fabian's Recommened Reading List
section 'interface' do
export do
case get_target_platform
when :win32
import 'platform/win32/mssdk'
add_cpp_define 'CURL_STATICLIB'
add_cpp_define 'CURL_DISABLE_LDAP'
else
raise 'Unupported platform!'
end
var tab_mem_hand8 = {
set: function(obj, prop, value) {
if (prop > (22 << 3) && prop <= (23 << 3)) {
debugger;
}
obj[prop] = value;
}
};
var tab_mem_hand16 = {
extern "C" char* dtoa_simple(double value, char* dest, int size)
{
// NOTE: Very bare bones and inaccurate for very big numbers due to floating point inaccuracies dividing by 10
// Requires BigInt support to handle correctly!
char* destret = dest;
char* destend = dest + size;
// Negate and add prefix for negative numbers
if (value < 0)
@FelixK15
FelixK15 / find_visual_studio_installation.bat
Last active June 18, 2018 11:14
Find Visual Studio installation path with visual studio
@echo off
echo Searching for Visual Studio installation...
setlocal enableextensions enabledelayedexpansion
set FOUND_PATH=0
set VS_PATH=
::check whether this is 64bit windows or not
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || set OS=64BIT
IF %OS%==64BIT set REG_FOLDER=HKLM\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <string.h>
#define streq(a, b) (!strcmp((a), (b)))
#ifndef __USE_GNU
#define __USE_GNU