This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Main { | |
private static function main():Void { | |
trace(-1 > (5: UInt)); | |
} | |
} | |
abstract UInt(Int) from Int to Int { | |
@:op(A + B) private static inline function add(a:UInt, b:UInt):UInt { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import haxe.Constraints.Function; | |
/* | |
Result: | |
src/Main.hx:16: Function bench | |
src/Main.hx:76: 0.019 sec | |
src/Main.hx:19: Signal bench | |
src/Main.hx:76: 0.01 sec | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pony.net.*; | |
import pony.net.rpc.*; | |
import pony.events.*; | |
import pony.time.MainLoop; | |
class RPCExample { | |
private static function main():Void { | |
MainLoop.init(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pony.net.SocketClient; | |
import pony.net.SocketServer; | |
import pony.time.MainLoop; | |
class NekoSockets { | |
private static function main():Void { | |
MainLoop.init(); | |
var port = 12345; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test { | |
static function main() { | |
var a = new SmartArray([1, 2, 3]); | |
for (e in a) { | |
trace(e); | |
if (e == 2) a.remove(1); | |
} | |
} | |
} | |
NewerOlder