Skip to content

Instantly share code, notes, and snippets.

@finscn
finscn / remove-t-junctions.js
Created June 28, 2026 14:29 — forked from mourner/remove-t-junctions.js
Post-processing fix for Earcut's non-comforming output
// Post-processing fix for Earcut's issue https://github.com/mapbox/earcut/issues/74
// Split triangle edges wherever another vertex lies strictly on them (exact-coordinate input).
export function removeTJunctions(data, tri) {
const n = data.length / 2;
// bucket every vertex into a uniform spatial hash so edge lookups stay local
let minx=Infinity,miny=Infinity,maxx=-Infinity,maxy=-Infinity;
for (let i=0;i<n;i++){const x=data[2*i],y=data[2*i+1];if(x<minx)minx=x;if(y<miny)miny=y;if(x>maxx)maxx=x;if(y>maxy)maxy=y;}
const size = Math.max(maxx-minx, maxy-miny) / Math.max(1, Math.sqrt(n)) || 1;
const key = (cx,cy) => cx*73856093 ^ cy*19349663;
// From http://baagoe.com/en/RandomMusings/javascript/
function Alea() {
return (function(args) {
// Johannes Baagøe <baagoe@baagoe.com>, 2010
var s0 = 0;
var s1 = 0;
var s2 = 0;
var c = 1;
if (args.length == 0) {
// From http://baagoe.com/en/RandomMusings/javascript/
function Alea() {
return (function(args) {
// Johannes Baagøe <baagoe@baagoe.com>, 2010
var s0 = 0;
var s1 = 0;
var s2 = 0;
var c = 1;
if (args.length == 0) {
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
#include <net/if.h>
void ip_for_interface(const char *interface_name, char *ip, const int length) {
*ip = NULL;
#include "dynamic_battlefog.h"
#include <cmath>
#include <set>
#include <map>
#include <assert.h>
#include <algorithm>
using std::max;
using std::min;
CDynamicBattleFog::CDynamicBattleFog()
@finscn
finscn / gist:2517406
Created April 28, 2012 09:16 — forked from haqu/gist:1016550
decoding PNG images from IPA package
mkdir _png
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -d _png -revert-iphone-optimizations -q *.png

IMPORTANT! Wikified version of this page may be found here. Feel free to edit. :)

Note that since it's kind of PITA to merge changes from other gists it's recommended that you do your changes directly to the wiki!

Game Engines

Name Latest Release Size (KB) License Type Unit Tests Docs Notes
Akihabara 1.3 GPL2/MIT Classic Repro Intended for making classic arcade-style games in JS+HTML5 3
Aves Commercial? Obsolete. Company bought by Zynga.