Skip to content

Instantly share code, notes, and snippets.

@incrediblejr
incrediblejr / ijlat.h
Created May 25, 2016 13:36
(Simple) Lua Allocation Tracker
/* ijlat.h - v0.1a - (Simple) Lua Allocation Tracker -- public domain -- @incrediblejr, May 2016
ABOUT
A simple Lua allocation tracker.
USAGE
The memory tracker is implemented as a [stb-style header-file library][1] which means that
in *ONE* source file, put:
@incrediblejr
incrediblejr / ijsl.h
Created April 11, 2018 04:43
quick and dirty printf-logging with (compile time) 'multiple outputs'
/* clang-format off */
/*
ijsl : IncredibleJunior Simple Log
quick and dirty printf-logging with (compile time) 'multiple outputs' implemented
as a stb-style header-file library[1] which means that in *ONE* source file declare
the implementation (see example) and the other source files should just include
this file.
example setup for Windows (declare OutputDebugStringA ourselves to avoid including windows.h)
/* clang-format off */
/*
ijss : IncredibleJunior SparseSet
sparse set [1] for bookkeeping of dense<->sparse index mapping or
a building block for a simple LIFO index/handle allocator
[1] https://research.swtch.com/sparse
*/
@incrediblejr
incrediblejr / optional_instance.h
Created August 15, 2019 11:18
optional instance created by placement-new with stack-memory
/*
* optional instance created by placement-new with stack-memory
*
* ex.
* struct ThreadContextScope {
* ThreadContextScope() { // setup thread-context }
* ~ThreadContextScope() { // teardown thread-context }
* };
*
* void some_function(void) {
@incrediblejr
incrediblejr / sokol_test.c
Created December 14, 2019 10:02
sokol_test.c
#define SOKOL_D3D11
#define SOKOL_IMPL
#include "sokol_app.h"
#include "sokol_gfx.h"
#include "sokol_time.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4201) /* warning C4201: nonstandard extension used : nameless struct/union */
@incrediblejr
incrediblejr / ijpathjoin.h
Last active January 8, 2023 15:10
join multiple path segments together with one allocation from optional user provided custom allocator or default (malloc)
#ifndef IJPATHJOIN_INCLUDED_H
#define IJPATHJOIN_INCLUDED_H
#include <stdarg.h> /* va_list */
#ifdef __cplusplus
extern "C" {
#endif
#if defined(IJPATHJOIN_STATIC)