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
#!/usr/bin/haxex | |
// Run with "./HaxeScript.hx some args here" | |
class HaxeScript | |
{ | |
public static function main() | |
{ | |
trace('Hi, the following ${Sys.args().length} arguments were passed in:'); | |
for (a in Sys.args()) |
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.ds.StringMap; | |
import haxe.web.Dispatch; | |
import haxe.web.Dispatch.DispatchError; | |
#if sys | |
import Sys.println; | |
import Sys.print; | |
#else | |
import haxe.Log.trace in println; | |
import haxe.Log.trace in print; |
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.macro.Expr; | |
import haxe.macro.Context; | |
class F | |
{ | |
macro public static function f(a : Expr, b : Int) : Expr | |
{ | |
// get the field name as a string, use Pattern Matching or tink macros probably... | |
var fieldName = switch (a.expr) { | |
case EConst(CIdent(name)): name; |
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.macro.Expr; | |
import haxe.macro.Context; | |
import sys.FileSystem; | |
import sys.io.File; | |
import haxe.io.Path; | |
class BuildMacro | |
{ | |
static function build() | |
{ |
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.macro.Expr; | |
import haxe.macro.Type; | |
import haxe.macro.Context; | |
class MacroTest | |
{ | |
macro public function build():Array<Field> | |
{ | |
trace ("Build macro"); |
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.macro.Expr; | |
import haxe.macro.Context; | |
import neko.Lib; | |
class BuildInMacroTests { | |
public static function main() { | |
var s:MyModel = new MyModel(); | |
Formatter.__Output_Formatter( s ); | |
} | |
} |
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 ArrayAccessTest { | |
static function main() { | |
var myArray:MyArray<Int> = [0,10,20]; | |
trace ( myArray[1] ); | |
trace ( myArray["one"] ); | |
trace ( myArray[["one","two","three"]] ); | |
} | |
} | |
abstract MyArray<T>(Array<T>) from Array<T> to Array<T> { |
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 Cast | |
{ | |
static function main() | |
{ | |
var array = [0,1,2,3]; | |
var list = Lambda.list( array ); | |
var map = [ "a"=>0, "b"=>1, "c"=>2 ]; | |
var stringMap:haxe.ds.StringMap<Int> = map; | |
var myAbstract:AbstractIterator<Int> = array; | |
var myAbstract2:AbstractIterator2<Int> = array; |
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
package sys.db; | |
@:coreApi class Mysql { | |
static var init = false; | |
/** | |
Opens a new MySQL connection on the specified path. | |
Note that you will need a MySQL JDBC driver. | |
"socket" option currently not supported |
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 Module1 | |
{ | |
static function main() { | |
SharedCode.greet("Jason"); | |
} | |
} |