Skip to content

Instantly share code, notes, and snippets.

View AxGord's full-sized avatar
🦄
Pony

Alexander Gordeyko AxGord

🦄
Pony
View GitHub Profile
@AxGord
AxGord / PostGen.hx
Created August 14, 2022 08:52
Post TypeScript to Haxe convert
import sys.io.File;
using StringTools;
final path: String = '../src/';
final ext: String = '.hx';
final map: Map<String, Array<String>> = [
'native package name' => ['Path to file, without extension']
];
@AxGord
AxGord / Main.hx
Last active June 4, 2023 22:40
Dependency injection
import haxe.Timer;
import pony.Logable;
import pony.magic.WR;
import pony.magic.DI;
// https://github.com/AxGord/Pony/commit/a0c68a0f5d92798b2054fd39dc9e370c0977f2a4
class Main implements DI {
@:service private final l: Logable = new Logable('Module:');
@:service private final myService: MyService = new MyService();
import pony.events.Event1;
import pony.events.Signal1;
import pony.magic.DI;
import pony.magic.HasListener;
import pony.magic.HasSignal;
import pony.time.DT;
import pony.time.DeltaTime;
@:nullSafety(Strict) class DynamicDeltaTimeService implements HasSignal implements HasListener implements DI {
class MatrixRotate {
static function main() {
final w = 3;
final h = 2;
final m = [
1, 0, 2,
0, 3, 4
];
p(r90(m, w, h), h, w);
p(r180(m, w, h), w, h);
@AxGord
AxGord / Test.hx
Created April 26, 2024 11:55
subtractionWithLimit
class Test {
static function main() {
trace(subtractionWithLimit(0, 2, 1));
}
static function subtractionWithLimit(a:UInt, b:UInt, min:UInt):Int {
return Std.int(Math.max(min + b, a)) - b;
}
}