Skip to content

Instantly share code, notes, and snippets.

View deltaluca's full-sized avatar

Luca Deltodesco deltaluca

View GitHub Profile
@deltaluca
deltaluca / Bug1.hx
Created March 28, 2012 11:48
Bug occuring in both flash+neko
import com.mindrocks.text.Parser;
using com.mindrocks.text.Parser;
import com.mindrocks.functional.Functional;
using com.mindrocks.functional.Functional;
using com.mindrocks.macros.LazyMacro;
import com.mindrocks.text.ParserMonad;
using com.mindrocks.text.ParserMonad;
@deltaluca
deltaluca / Bug2.hx
Created March 28, 2012 12:26
Stack overflow in flash Parsex bug.
import com.mindrocks.text.Parser;
using com.mindrocks.text.Parser;
import com.mindrocks.functional.Functional;
using com.mindrocks.functional.Functional;
using com.mindrocks.macros.LazyMacro;
using Lambda;
package nape;
!!/**
!! * Configuration parameters for Nape
!! */
@:final class Config {
!!/**
!! * Construct new configurations object.
!! */
public function new() {}
@deltaluca
deltaluca / gist:5104163
Created March 6, 2013 23:18
pipe dream haxe
typedef Monad<M> = {
static function bind<A,B>(a:M<A>, f:A->M<B>):M<B>;
static function ret<A>(a:A):M<A>;
}
enum MaybeImpl<A> {
mJust(a:A);
mNothing);
}
@deltaluca
deltaluca / gist:5152448
Last active December 14, 2015 21:39
typed flags haxe.
abstract Flags(Int) to Int {
public static var A(default,never):Flags = 1;
public static var B(default,never):Flags = 2;
public static var C(default,never):Flags = 4;
@:from inline static function fromInt(x:Int) return new Flags(x);
inline function new (f:Int) this = f;
@:op(A|B) inline public static function join(a:Flags, b:Flags):Flags {
var _a:Int = a;
package cv;
import #if cpp cpp #else neko #end.Lib;
import cv.core.*;
import cv.core.Scalar.Scalar_;
import cv.core.Scalar.RGB;
import cv.Macros;
typedef Arr = NativeBinding; // Image|Mat|Seq?
@deltaluca
deltaluca / gist:5244269
Created March 26, 2013 09:58
modified haxe syntax file for vim, good enough for me.
" Vim syntax file
" Language: haxe
" Please check :help haxe.vim for comments on some of the options available.
"set errorformat=%f\:%l\:\ characters\ %c-%*[^\ ]\ %m,%f\:%l\:\ %m
set errorformat=%f\:%l\:\ characters\ %c-%*[^\ ]\ %m,%f\:%l\:\ %m
" Quit when a syntax file was already loaded
if !exists("main_syntax")
@deltaluca
deltaluca / gist:5278981
Last active December 15, 2015 15:08
Creating window with OpenCV and capturing video feed from file, converted to greyscale. Rendering video feed to a rotating cube of cubes with OpenGL.
package;
import cv.Core;
import cv.HighGUI;
import cv.ImgProc;
import ogl.GL;
class Main {
static var v2 = GL.v2;
static var v3 = GL.v3;
@deltaluca
deltaluca / Macros.hx
Created April 16, 2013 19:50
convert long param functions into params object functions.
package;
#if macro
import haxe.macro.Expr;
import haxe.macro.Context;
#end
@:autoBuild(LongParamsImpl.run()) interface LongParams {}
class LongParamsImpl {
@deltaluca
deltaluca / gist:5413225
Created April 18, 2013 14:37
16.16 Fixed point numbers in Haxe 3
abstract Fixed16(Int) {
inline function new(x:Int) this = x;
inline function raw() return this;
inline static function RAW(x:Int) return new Fixed16(x);
public static var MAX_VALUE:Fixed16 = RAW(0x7fffffff);
public static var MIN_VALUE:Fixed16 = RAW(1);
@:from public static inline function fromf(x:Float) {
#if debug