Skip to content

Instantly share code, notes, and snippets.

@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
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
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 / 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 / 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 / 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 / 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 / readme.md
Created January 9, 2012 15:03
haxe-pygments.appspot.com readme

Welcome

Haxe-Pygment is an unofficial API for the Pygments syntax highlighting library, version 1.4. It's designed to provide syntax highlighting for web applications that don't have Python installed.


Usage

POST to http://haxe-pygments.appspot.com with lang and code parameters in the body.

@skial
skial / Build.hx
Created December 21, 2011 12:11
Haxe Macro | Access build field doc
package uhu.macro.doc;
import haxe.macro.Context;
import haxe.macro.Expr;
import neko.io.File;
import neko.io.FileOutput;
/**
* ...
* @author Skial Bainn
*/
@skial
skial / Date.hx
Created December 8, 2011 23:08
Near to minimal php as possible - minimal code example
package ;
/**
* ...
* @author Skial Bainn
*/
extern class Date {
// http://www.php.net/manual/en/function.mktime.php