Skip to content

Instantly share code, notes, and snippets.

@Zshazz
Zshazz / A.hx
Last active August 29, 2015 14:02
My first build macro in Haxe plus example usage
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 11:04
Two seperate issues I've had with Haxe 3.1.3 thus far...
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 December 1, 2013 13:18
Test code & results for std.random.dice that accepts SortedRange
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) {