Skip to content

Instantly share code, notes, and snippets.

View haxiomic's full-sized avatar
:octocat:
Everything is happening

George Corney haxiomic

:octocat:
Everything is happening
View GitHub Profile
@haxiomic
haxiomic / Haxe Makefile
Last active April 1, 2019 08:22
Haxe makefile with file watching. Requires fswatch (`brew install fswatch`)
HXML ?= $(shell find . -name "*.hxml" -print -quit)
SOURCES ?= $(shell find . -name "*.hx")
# Determine output file or directory from target arguments in HXML
OUTPUT ?= $(shell echo ' \
class M { static function main() { \
var r = ~/^\s*-?-(js|lua|swf|as3|neko|php|cpp|cppia|cs|java|python|hl)\s+([^\\n]+)/im; \
if (r.match(sys.io.File.getContent(Sys.args()[0]))) \
Sys.print(r.matched(2)); \
} } \
# Global State
[select object]
- activeTexture(unit:TextureUnit)
- bindBuffer(target:BufferTarget, buffer:GLBuffer)
- bindFramebuffer(target:FramebufferTarget, framebuffer:GLFramebuffer)
- bindRenderbuffer(target:RenderbufferTarget, renderbuffer:GLRenderbuffer)
- bindTexture(target:TextureTarget, texture:GLTexture)
- useProgram(program:GLProgram)
[primtive draw state]
@haxiomic
haxiomic / Scope-Preserving-Split.hx
Created April 18, 2019 21:05
Split by character, but not inside scopes
function scopePreservingSplit(str: String, by: String) {
var scopePairs = ['()', '[]', '{}', '<>'];
var scopeState = [0, 0, 0, 0];
var parts = new Array<String>();
var buffer = '';
inline function handleScope(c) {
for (i in 0...scopePairs.length) {
var open = scopePairs[i].charAt(0);
var close = scopePairs[i].charAt(1);
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
vec2 rotate(vec2 p, float radians) {
float c = cos(radians);
@haxiomic
haxiomic / setHaxeVersion.sh
Created September 11, 2019 16:59
set haxe version bash
#folders should be named like: haxe-3.1.3, and the regular haxe folder should be removed
alias setHaxeVersion=_set_haxe_version
function _set_haxe_version(){
HAXE_PARENT="$(dirname "$HAXE_HOME")"
FIND_RESULT="`find $HAXE_PARENT -maxdepth 1 -name "haxe-*$1"`"
NUM_RESULTS=`echo "$FIND_RESULT" | wc -l`
if [[ $NUM_RESULTS -eq 1 ]] && [[ -n $FIND_RESULT ]] ; then
// Author: @patriciogv
// Title: Simple Voronoi
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
static function relativePath(relativeTo: String, path: String) {
// make both absolute
path = Path.removeTrailingSlashes(FileSystem.absolutePath(path));
relativeTo = Path.removeTrailingSlashes(FileSystem.absolutePath(relativeTo));
var aPath = path.split('/');
var aRelativeTo = relativeTo.split('/');
// find shared part of path
var matchesUpToIndex = 0;
// https://www.shadertoy.com/view/dlfXDN
// 2023 myth0genesis
// 4D Simplex Noise Gradient
// I saw that Stefan Gustavson didn't seem to have published any shader
// with an analytic solution for the gradients of his variant
// of 4D simplex noise, so I thought I'd try solving it myself
// and publish it here for anyone who finds it useful.
// Compares the analytic solution to the numerically approximated one (for a sanity check)
// and shows the results of all four derivatives with respect to each dimension.
// Top : Analytic gradient | Bottom: Forward differences approximated gradient
@haxiomic
haxiomic / fxaa.glsl
Created July 15, 2020 14:00
Mirror of NVIDIA FXAA 3.11 by TIMOTHY LOTTES
/*============================================================================
NVIDIA FXAA 3.11 by TIMOTHY LOTTES
------------------------------------------------------------------------------
COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED.
------------------------------------------------------------------------------
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
@haxiomic
haxiomic / gist:d9cfa0f94c9f555a5dd39f70cfdeec38
Created July 26, 2020 12:45
@skylerparr lldb stack trace for StandaloneMain-debug
* thread #2, stop reason = EXC_BAD_ACCESS (code=2, address=0x700000897ca0)
frame #0: 0x0000000100004df4 StandaloneMain-debug`hx::ObjectPtr<hx::Object>::ObjectPtr(this=0x0000700000897ca0, inObj=0x0000000103ea850c) at Object.h:333:36
330 typedef OBJ_ *Ptr;
331
332 inline ObjectPtr() : mPtr(0) { }
-> 333 inline ObjectPtr(OBJ_ *inObj) : mPtr(inObj) { }
334 inline ObjectPtr(const null &inNull) : mPtr(0) { }
335 inline ObjectPtr(const ObjectPtr<OBJ_> &inOther) : mPtr( inOther.mPtr ) { }
336 template<typename T>
Target 0: (StandaloneMain-debug) stopped.