Skip to content

Instantly share code, notes, and snippets.

@Zshazz
Zshazz / A.hx
Last active Aug 29, 2015
My first build macro in Haxe plus example usage
View A.hx
package;
@:enum
abstract StateID(Int) to Int
{
var one = 0;
var two = 1;
var three = 2;
// must always have last number
@Zshazz
Zshazz / metadataBreak.hx
Created May 31, 2014
Two seperate issues I've had with Haxe 3.1.3 thus far...
View metadataBreak.hx
import haxe.rtti.Meta;
class MetadataBreak {
static public function main() {
var mdb = new MetadataBreak();
// OK
trace(Meta.getFields(MetadataBreak).test.somedata.length);
trace(Meta.getFields(MetadataBreak).test.somedata[0]);
@Zshazz
Zshazz / diceTest.d
Created Dec 1, 2013
Test code & results for std.random.dice that accepts SortedRange
View diceTest.d
import std.stdio, std.datetime, std.random, std.range, std.typetuple;
Random rng;
void main() {
rng = Random(123102);
alias propSizes = TypeTuple!(5, 10, 500, 100_000, 10_000_000);
foreach(i, propSize; propSizes) {
foreach(j, fn; TypeTuple!(testNormal, testSorted)) {
static if(j == 0) {