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 tests; | |
import js.Node; | |
using AsyncLambda; | |
class TestNode implements async.Build{ | |
@:async static function writeAll(fd:Int, content:String){ | |
var total = 0, length = content.length; | |
while (total > length){ | |
async(written = Node.fs.write(fd, content, total, length - total, null)); | |
total+= written; |
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
var vm = require('vm'), | |
code = 'var square = n * n;', | |
fn = new Function('n', code), | |
script = vm.createScript(code), | |
sandbox; | |
n = 5; | |
sandbox = { n: n }; | |
benchmark = function(title, funk) { |
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
abstract FunctionReturning<T>(Dynamic) { | |
inline function new (x:Dynamic) this = x; | |
@:from static inline function from0 <T>(x:Void->T):FunctionReturning<T> return new FunctionReturning(x); | |
@:from static inline function from1 <T>(x:Dynamic->T):FunctionReturning<T> return new FunctionReturning(x); | |
@:from static inline function from2 <T>(x:Dynamic->Dynamic->T):FunctionReturning<T> return new FunctionReturning(x); | |
@:from static inline function from3 <T>(x:Dynamic->Dynamic->Dynamic->T):FunctionReturning<T> return new FunctionReturning(x); | |
/* ... */ | |
} | |
class Test { |
NewerOlder