This file contains 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
//implicit parameters | |
// use _ for unary functions or _1 _2 _3 for multiple arguments functions | |
fn(_ + 1); | |
fn(_1 + _2); | |
//explicit parameters | |
// use x => for single argument | |
// and [x,y,z] => for multiple arguments | |
fn(x => x + 1); |
This file contains 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
[1,2,3,4,5].filter.fn( _ >= 3 ).map.fn( _ + 1) |
This file contains 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
using Path; | |
class Main { | |
public static function main() { | |
var w:Dynamic = untyped dynamic_object; | |
w.path(_.a.bc.d.e.f.g.h); | |
w.path(_.a.bc.d.e.f.g.h = 2); | |
} | |
} |
This file contains 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
using riot.RiotTools; | |
@:keep | |
class BaseComponent implements riot.IRiotComponent { | |
public var view:Dynamic; | |
@:bind function incr() { | |
js.Lib.debug(); | |
view.counter++; | |
} |
This file contains 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
@:tagName('component-inheritance-2') | |
@:template(' | |
component inheritance 2 | |
<button onclick={incr}>incr</button> | |
<button onclick={async_incr}>async incr</button> | |
<span class="counter2">{counter}</span> | |
') | |
@:css(' | |
.counter2 { | |
background:yellow; |
This file contains 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
using riot.RiotTools; | |
@:tagName('counter') | |
@:templateFile('templates/counter/counter.html') | |
@:cssFile('templates/counter/counter.css') | |
@:autoMount | |
@:keep | |
class Component implements riot.IRiotComponent { | |
public var view:Dynamic; |
This file contains 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; | |
import python.KwArgs; | |
using python.Lib; | |
@:pythonImport("flask", "request") | |
extern class Request implements Dynamic { | |
public static var args:python.Dict<String,Dynamic>; | |
} |
This file contains 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.Context; | |
import haxe.macro.Expr; | |
using haxe.macro.ExprTools; | |
using haxe.macro.MacroStringTools; | |
class Cond { | |
static function processDSL(e:Expr) { | |
return switch e { |
This file contains 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; | |
using haxe.macro.ExprTools; | |
using haxe.macro.MacroStringTools; | |
class Dsl { | |
static function processDSL(e:Expr) { | |
return switch e { | |
case macro @select $i{select}: { | |
macro 'you say select ${select}'; |
This file contains 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
<?php | |
class Main { | |
public function __construct(){} | |
static function newSlimApp() { | |
return _hx_anonymous(array("app" => new \Slim\App())); | |
} | |
static function main() { | |
$slim = _hx_anonymous(array("app" => new \Slim\App())); | |
{ |