Skip to content

Instantly share code, notes, and snippets.

@l0go
l0go / 1-description.md
Last active October 2, 2023 23:24
Haxe People on the Fediverse

Haxe People on the Fediverse

With the recent rise of alternative social media platforms, the Haxe community will get splintered. This is a compilation of users of the Haxe language who has a presence on these platforms.

@haxiomic
haxiomic / ObjectPool.hx
Last active September 21, 2023 12:48
Structure of Array and Array of Structures in Haxe
/**
* ObjectPool is a type building macro to create array-of-structure or structure-of-array pools.
* With the intention being to improve access performance, both in CPU cache coherence and by avoiding the GC
*
* This implementation is a minimal working proof of concept
*
* Improvements you may want to make
* - Support deallocation of instances and space reclaiming
* - Replace haxe.io.Bytes because field access has overhead
*
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
https://github.com/HaxeFoundation/hashlink/tree/master/other/benchs
[Benchmark]
└─ [target] [buildtime] : [runtime]
---
OS: Arch Linux x86_64
Kernel: 4.17.2-1-ARCH
@haxiomic
haxiomic / Partial.hx
Last active February 26, 2023 11:44
Haxe macro to make all fields of a type optional (similar to Typescript's Partial<T>)
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.TypeTools;
#if !macro
@:genericBuild(PartialMacro.build())
#end
class Partial<T> {}
class PartialMacro {

Let's do some cppia

Note! Created a repo to replace this gist: https://github.com/cambiata/Haxe-Cppia-Basics Easier to testrun, fork and pr! Thanks, @PDeveloper!

This is a simple testproject created for the single purpose of learning how to use cppia, the scripable "cpp subtarget" for Haxe, created by Hugh Sanderson.

Info about cppia can be found in Hugh's WWX2015 talk (cppia part starts around 15:45).

Please note that this is WORK IN PROGRESS, and that I haven't yet found out to create a working cppia host..! Please step in with discussion and contributions!

@mrcdk
mrcdk / Macros.hx
Created March 31, 2016 00:33
@:enum abstract Something(Int) autoInt() macro
import haxe.macro.Context;
import haxe.macro.Expr;
class Macros {
macro public static function autoInt():Array<Field> {
var fields = Context.getBuildFields();
var t = switch(Context.getLocalClass().get().kind) {
case KAbstractImpl(c):
@jcward
jcward / Main.hx
Last active September 12, 2020 10:58
Haxe typed compile time constants example macro (parsing or evaluating)
// In a build system, I like to pass typed compile-time constants to my code
// via compiler defines. For example, a host String and a port Int. The
// following macros provide functionality to either parse or eval a compiler
// define as Haxe code. Since they operate at compile time and inject the
// resulting expressions into your code, this retains all type features --
// from type inference to type checking.
//
// Note that $type prints the type at compile time, while trace prints
// the value at runtime. Neko is called simply to demonstrate the latter.
import haxe.macro.Context;
@mrcdk
mrcdk / OneOf.hx
Last active July 9, 2020 03:20
OneOf abstract: An abstract that uses haxe.ds.Either as its base type and hides the explicit use of it. http://try.haxe.org/#c0557
import haxe.ds.Either;
abstract OneOf<A, B>(Either<A, B>) from Either<A, B> to Either<A, B> {
@:from inline static function fromA<A, B>(a:A) : OneOf<A, B> return Left(a);
@:from inline static function fromB<A, B>(b:B) : OneOf<A, B> return Right(b);
@:to inline function toA():Null<A> return switch(this) {case Left(a): a; default: null;}
@:to inline function toB():Null<B> return switch(this) {case Right(b): b; default: null;}
}
@deathbeam
deathbeam / Main.rb
Last active September 23, 2015 12:06
Raxe example
# Require some other modules
require "openfl/display/Sprite"
require "openfl/events/Event"
require "openfl/Lib"
# Set type of this module to class and extend it by OpenFL sprite
module class extends Sprite
# Module variables
def static appname = "My Application"