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
#!/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 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 thunkDispatcherRef = { | |
dispatch: function () {} | |
} | |
/** | |
* The angular injection middleware allows our redux actions to return functions. | |
* | |
* The function will be executed with regular angular dependency injection, allowing | |
* you to use angular services in Redux actions. | |
* |
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
/** | |
A super basic interactive console for haxe. | |
Done because someone on the mailing list asked and I got distracted :) | |
Consider this code Public Domain. | |
Jason O'Neil | |
Run using: | |
haxe -lib hscript -x Console.hx | |
(you will need hscript installed via haxelib) |
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; | |
import haxe.macro.Context; | |
class ClassicSwitch | |
{ | |
macro static public function from(inExpr:Expr):Expr | |
{ | |
var retExpr:Expr = null; | |
switch (inExpr.expr) |
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
browsertime.pageSummary.browserScripts.0.pageinfo.documentHeight | |
browsertime.pageSummary.browserScripts.0.pageinfo.documentWidth | |
browsertime.pageSummary.browserScripts.0.pageinfo.responsive | |
browsertime.pageSummary.browserScripts.0.timings.firstPaint | |
browsertime.pageSummary.browserScripts.0.timings.fullyLoaded | |
browsertime.pageSummary.browserScripts.0.timings.navigationTiming.connectEnd | |
browsertime.pageSummary.browserScripts.0.timings.navigationTiming.connectStart | |
browsertime.pageSummary.browserScripts.0.timings.navigationTiming.domComplete | |
browsertime.pageSummary.browserScripts.0.timings.navigationTiming.domContentLoadedEventEnd | |
browsertime.pageSummary.browserScripts.0.timings.navigationTiming.domContentLoadedEventStart |
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
.wysiwyg-color-black { | |
color: #000; } | |
.wysiwyg-color-black70 { | |
color: #4d4d4d; } | |
.wysiwyg-color-black60 { | |
color: #666666; } | |
.wysiwyg-color-black50 { | |
color: gray; } | |
.wysiwyg-color-black40 { | |
color: #999999; } |
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.Type; | |
import haxe.macro.Expr; | |
import sys.io.File; | |
class WebpackLoaderUtil { | |
public static function outputJson(outputFile:String) { | |
Context.onGenerate(function (types:Array<Type>) { | |
var allFilesUsed = []; | |
for (type in types) { |
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
class Metric { | |
static function main() { | |
var coinRadius:Millimeters = 12; | |
var myHeight:Centimeters = 180; | |
var raceLength:Meters = 200; | |
var commuteDistance:Kilometers = 23; | |
diff( coinRadius, myHeight ); // 1.788 meters | |
diff( raceLength, commuteDistance ); // 22800 meters | |
sum( commuteDistance, coinRadius ); // 23000.012 meters |
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
class ReflectionCost { | |
public static function main() { | |
var obj = new ReflectionCost(); | |
#if reflect | |
Reflect.setField( obj, "name", "Jason" ); | |
Reflect.callMethod( obj, Reflect.field(obj, "printName"), [] ); | |
Type.getInstanceFields( Type.getClass(obj) ); | |
#else | |
obj.name = "Jason"; | |
obj.printName(); |
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
class Test { | |
static function main(){ | |
stringOrInt( "hello" ); | |
stringOrInt( 10 ); | |
} | |
static function stringOrInt( either:AcceptEither<String,Int> ) { | |
switch either.type { | |
case Left(str): trace("string: "+str); | |
case Right(int): trace("int: "+int); |
NewerOlder