Skip to content

Instantly share code, notes, and snippets.

@RealyUniqueName
RealyUniqueName / Main.hx
Created August 29, 2015 07:44
Get string representation of function signature
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Type;
using haxe.macro.Tools;
class Main
{
package;
import datetime.DateTime;
import datetime.Timezone;
class Test {
static public function main () {
var utc = DateTime.now();
var zone = Timezone.local();
@RealyUniqueName
RealyUniqueName / EventBuilder.hx
Last active October 30, 2015 09:49
Add getter & setter to openfl.events.Event
package;
import haxe.macro.Context;
import haxe.macro.Expr;
class EventBuilder
{
/**
* Description
@RealyUniqueName
RealyUniqueName / gist:5844305
Last active December 18, 2015 20:59
Traits interface example
package people.jobs;
import traits.ITrait;
import traits.Trait;
/**
* Example trait interface
*
@RealyUniqueName
RealyUniqueName / Main.hx
Last active December 19, 2015 08:19
Simple StablexUI project
package;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.Lib;
import ru.stablex.ui.UIBuilder;
import ru.stablex.ui.widgets.Bmp;
import ru.stablex.ui.widgets.Widget;
import ru.stablex.ui.widgets.HBox;
@RealyUniqueName
RealyUniqueName / Builder.hx
Created July 21, 2013 21:39
Changing base class based on compilation flags
import haxe.macro.Context;
import haxe.macro.Type;
class Builder{
macro static public function getSpriteClass () : Type {
var cls : String = (
Context.defined("custom_base")
? Context.definedValue("custom_base")
: "flash.display.Sprite" //by default use this class
package pony.flash;
import haxe.macro.Expr;
import pony.events.Signal;
#if !macro
import flash.external.ExternalInterface;
#end
/**
* ...
* @author AxGord
*/
@RealyUniqueName
RealyUniqueName / Main.hx
Created October 22, 2013 09:36
Actuate fails to call setters of classes which extend classes with type parameters. Affected versions: 1.6.3 - 1.7.0
package;
import flash.display.Shape;
import flash.display.Sprite;
import flash.Lib;
import motion.Actuate;
class Main extends Test<Shape>{
/** this setter is not called on tweening */
@RealyUniqueName
RealyUniqueName / Base.hx
Last active December 27, 2015 03:59
haxe.macro.MacroType issue
package ;
/**
* Base class
*
*/
class Base{
}//class Base
@RealyUniqueName
RealyUniqueName / Exception.hx
Created November 28, 2013 12:09
Simple exception class with stack information
package fst.exception;
import haxe.CallStack;
/**
* Exceptions base
*
*/
class Exception {