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
//https://try.haxe.org/#100D46B4 | |
function main() { | |
trace( 'Math.PI' ); | |
var val = [ tau+pie | |
, tau+pie_2 | |
, tau | |
, tau3_4 | |
, pie | |
, pie_2 | |
, 0 |
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
// https://try.haxe.org/#2C719963 | |
@:forward | |
abstract AtArray<T>( Array<T> ) from Array<T> to Array<T> { | |
public inline function new( arr: Array<T> ){ | |
this = arr; | |
} | |
public inline function at( i: Int ): T{ | |
i = if( i < 1 ){ | |
this.length + i; | |
} else { |
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
package samples.examples.big_ben.views; | |
import divtastic.js.DisplayDiv; | |
import divtastic.js.Divtastic; | |
import divtastic.js.Drawing; | |
import divtastic.js.application.views.WindowView; | |
using divtastic.js.Drawing; |
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
// https://try.haxe.org/#9cFa6257 | |
@:structInit | |
class Vector { | |
public var x: Float; | |
public var y: Float; | |
public var _vector( get, never ): Vector_; | |
inline function get__vector(): Vector_ return ( this: Vector_ ); | |
public inline function new( x: Float, y: Float ){ | |
this.x = x; this.y = y; | |
} |
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
function main() testWeird(); | |
function testWeird(){ | |
var b: Null<Bool> = null; | |
final bReturn = function(b2: Bool){ | |
b = b2; | |
return b; | |
}; | |
var f: Float = 0.; | |
final fReturn = function( f2: Float ){ | |
f = f2; |
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
final doc = js.Browser.document; | |
function main() { | |
addText().innerHTML = reverseBdo( 'racecar' ); | |
addText().innerHTML = reverseStr( 'racecar' ); | |
} | |
function addText(){ | |
final div = doc.createDivElement(); | |
doc.body.appendChild( div ); | |
return div; | |
} |
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.io.ArrayBufferView; | |
import haxe.io.UInt8Array; | |
import haxe.io.UInt16Array; | |
final isLittleEndian = (() -> { | |
var arrayBuffer = new ArrayBufferView(2); | |
var uint8Array = UInt8Array.fromData( | |
( cast arrayBuffer.getData(): UInt8ArrayData ) | |
); | |
var uint16array = UInt16Array.fromData( | |
( cast arrayBuffer.getData(): UInt16ArrayData ) |
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
https://try.haxe.org/#8908F4d5 | |
@:access(IntIterator.min, IntIterator.max ) | |
class FizzBuzz_ { | |
public var start: Int; | |
public var max: Int; | |
public var fizz: Int = 0; | |
public var buzz: Int = 0; | |
public inline function new( start: Int, max: Int ){ | |
this.start = start; | |
this.max = max; |
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() { | |
var str = | |
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. | |
Nulla vel est iaculis, lobortis risus a, accumsan dolor. | |
Aenean at mi consequat, scelerisque urna eu, suscipit leo. | |
Cras eu urna vel erat vestibulum condimentum sit amet sit amet ante. | |
Nullam vestibulum tellus quis imperdiet malesuada. | |
Donec tincidunt risus id sodales tempor. |
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 js.html.KeyboardEvent; | |
import js.Browser; | |
import js.html.HTMLDocument; | |
import js.html.CanvasRenderingContext2D; | |
import js.html.CanvasElement; | |
import js.html.Node; | |
typedef Point = { x: Int, y: Int }; | |
class Test { | |
static function main() { new Test(); } | |
var px = 10; |