Skip to content

Instantly share code, notes, and snippets.

@skial
skial / readme.md
Created January 9, 2012 15:38
haxe-markdown2.appspot.com readme

Welcome

Haxe-Markdown2 is an unofficial API for the Markdown2 library. It's designed to provide markdown conversion for web applications that don't have Python installed.


Usage

POST to http://haxe-markdown2.appspot.com with the markdown parameter in the body.

@skial
skial / example.js
Created January 19, 2012 11:33
normal haxe/javascript class.__init__ output compared to custom haxe/javascript class.__init__ output
// normal haxe/javascript output for class.__init__ methods
{
js.Lib.document = document;
js.Lib.window = window;
onerror = function(msg,url,line) {
var f = js.Lib.onerror;
if( f == null )
return false;
return f(msg,[url+":"+line]);
}
@skial
skial / VarArgMacro.hx
Created October 7, 2012 10:45
@:overload and @:macro via andy li google groups haxe mailing list
// https://groups.google.com/d/msg/haxelang/IAqSXSREyHA/hjq-ZcLAcr4J
@:overload(function(a:Dynamic,b:Dynamic):Void{})
@:overload(function<A,B,C>(a:A, b:B, c:C):C{})
@:macro public static function foo(args:Array<Expr>):Expr {
return switch (args.length) {
case 2: args[0];
case 3: args[2];
default: throw "wrong args";
}
@skial
skial / A.hx
Last active December 16, 2015 06:59
Haxe Method Cascades [experiement] - http://www.dartlang.org/articles/m1-language-changes/#cascades
package ;
class A {
public function new() {
}
public function some() {
@skial
skial / Macro.hx
Last active December 17, 2015 06:18
Haxe async to sync style metadata thingy, supporting auto completion. Inspired by https://github.com/koush/node/wiki/%22async%22-support-in-node.js which was inspired by C# await keyword. Using Haxe r6632
package example.inlineMeta;
import haxe.macro.Printer;
import haxe.macro.Type;
import haxe.macro.Expr;
import haxe.macro.Context;
/**
* ...
* @author Skial Bainn
@skial
skial / Macro.hx
Created May 24, 2013 08:37
An improved version of https://gist.github.com/skial/5563966. The generated output is ugly, and reads backwards. Should work for any target. Only tested on haxejs. Fun little experiment. Using Haxe r6642
package example.inlineMeta;
import haxe.ds.Option;
import haxe.ds.StringMap;
import haxe.macro.Type;
import haxe.macro.Expr;
import haxe.macro.Context;
import haxe.macro.TypeTools;
using uhu.macro.Jumla;
@skial
skial / Macro.hx
Created May 24, 2013 13:34
Basic experiment to add named arguments / parameters to Haxe. Using Haxe r6642
package example.namedArgs;
import haxe.macro.Type;
import haxe.macro.Expr;
import haxe.macro.Context;
using StringTools;
using uhu.macro.Jumla;
/**
@skial
skial / Macro.hx
Last active December 3, 2018 15:23
Get function name in 3 different ways, each in increasing amounts of magic.
package example.methodName;
import haxe.macro.Printer;
import haxe.macro.Type;
import haxe.macro.Expr;
import haxe.macro.Context;
/**
* ...
* @author Skial Bainn
@skial
skial / Main.hx
Created November 8, 2013 15:24
Abstract bug?
package ;
using Lambda;
class Main {
public static function main() {
var a = ['a', 'b', 'c'];
var m:MyArray = a;
@skial
skial / MacroHijacked.hx
Created February 20, 2014 14:10
Initial step towards creating `Hijacked` type's. Probably a more appropriate name for this.
package ;
import haxe.macro.Type;
import haxe.macro.Expr;
import haxe.macro.Context;
using haxe.macro.Tools;
class MacroHijacked {