Skip to content

Instantly share code, notes, and snippets.

unit BitStream;
interface
uses fgl;
type
TBitReader = class
private
FBuffer: PByte;
@urraka
urraka / stb.c
Last active January 21, 2024 00:20
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#define STBI_ONLY_PNG
#define STBI_ONLY_JPEG
#define STBI_ONLY_BMP
#define STBI_ONLY_GIF
#include "stb_image.h"
#include "stb_image_write.h"
@urraka
urraka / st-alt-hook.c
Created July 8, 2015 16:28
Keyboard hook for preventing SublimeText from focusing menu when pressing ALT on windows.
// gcc -DHOOKDLL -shared -o bin/st-alt-hook.dll st-alt-hook.c
// gcc bin/st-alt-hook.dll -mwindows st-alt-hook.c -o bin/st-alt-hook.exe
#include <windows.h>
#ifdef HOOKDLL
// *************** DLL ***************
static HHOOK hKeyboardHook = 0;
@urraka
urraka / -usage-.php
Last active July 5, 2021 13:40
Twig extension for correct indentation of the output.
<?php
require_once 'vendor/autoload.php'; // or however you load Twig
require_once 'Lexer.php';
require_once 'Indent.php';
$twig = new Twig_Environment(new Twig_Loader_Filesystem('templates'));
$twig->addExtension(new Indent_Twig_Extension());
$twig->setLexer(new Indent_Twig_Lexer($twig));
skeleton
bone l50
@[red] :circle d30 t0 f#F00
@[blue] :circle d30 t0 f#00F
@line :path
L 0,0:handle
bone.handle
anim "test" 20fps
bone 40:sio
# overridable variables:
# * project -> defaults to parent dir basename
# * src-root -> defaults to src
# * out-root -> defaults to bin
# * debug -> define it to anything for debug mode
# * platform -> possible values are win32,osx,linux,ios,iossim
# * inc, inc-* -> where * is the platform
# * lib, lib-* -> where * is the platform
# * flg, flg-* -> where * is the platform
# * ios.version -> installed sdk version
@urraka
urraka / build.mk
Last active January 25, 2022 06:56
makefile for building c/c++ projects
# overridable variables:
# * project -> defaults to parent dir basename
# * src-root -> defaults to src
# * out-root -> defaults to bin
# * debug -> define it to anything for debug mode
# * platform -> possible values are win32,osx,linux,ios,iossim
# * inc, inc-* -> where * is the platform
# * lib, lib-* -> where * is the platform
# * flg, flg-* -> where * is the platform
# * ios.version -> installed sdk version
// 2D triangulation using ear clipping by urraka
//
// Usage:
// std::vector<vec2> polygon;
// std::vector<int> result = math::triangulate<int>(polygon);
//
// * vec2 is anything that has float x,y
// * result is a list of indices that point to the polygon vector (a triangle is defined every 3 indices).
#include <vector>