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
{ | |
"requireCurlyBraces": ["else", "for", "while", "do", "try", "catch"], | |
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], | |
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], | |
"disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], | |
"requireRightStickedOperators": ["!"], | |
"requireLeftStickedOperators": [","], | |
"disallowImplicitTypeConversion": ["string"], | |
"disallowKeywords": ["with"], | |
"disallowMultipleLineBreaks": true, |
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 MainTest { | |
static public function main() { | |
trace("Hello world!"); | |
trace('Fibonacci of 7 is: ${fibonacci(7)}'); | |
} | |
static function fibonacci(n) { | |
if (n == 0) return 0; | |
else if (n == 1) return 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
/* | |
Syntax: | |
if (condition) then (action) | |
if [(condition), (condition)] then [(action), (action)] | |
*/ | |
/* | |
Testing: | |
function testRule(correct :Bool, s :String) { |
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 Foo { | |
public function new( val ) x = val; | |
public var x : Int; | |
} | |
abstract ConstFoo(Foo) from Foo { | |
public var x(get, never) : Int; | |
function get_x() return this.x; | |
} |
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
// Haxe implementation ported from https://gist.github.com/Flafla2/f0260a861be0ebdeef76 | |
// Related article: http://flafla2.github.io/2014/08/09/perlinnoise.html | |
class Perlin { | |
public var repeat :Int; | |
public function new(repeat :Int = -1) { | |
this.repeat = repeat; | |
} |
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
// Minimal test of a stack machine (https://en.wikipedia.org/wiki/Stack_machine) | |
enum Bytecode { | |
PUSH(v :Int); | |
ADD; | |
MULT; | |
PRINT; | |
} | |
class StackMachine { |
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
// Adapated from java source by Herman Tulleken | |
// http://www.luma.co.za/labs/2008/02/27/poisson-disk-sampling/ | |
// The algorithm is from the "Fast Poisson Disk Sampling in Arbitrary Dimensions" paper by Robert Bridson | |
// http://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf | |
// Code adapted from http://theinstructionlimit.com/fast-uniform-poisson-disk-sampling-in-c | |
typedef Vector2 = { x :Float, y :Float } |
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
-- grabbed from http://www.lexaloffle.com/bbs/?pid=28105 | |
function jitter(points) | |
for i = 1, #points do | |
p = points[i] | |
p.x += rnd(2) - 1 | |
p.y += rnd(2) - 1 | |
end | |
end |
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.crypto.Base64; | |
import haxe.crypto.Hmac; | |
import haxe.io.Bytes; | |
class Analytics { | |
var game_key :String; | |
var secret_key :String; | |
public function new(game_key :String, secret_key :String) { | |
this.game_key = game_key; |
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 ; | |
import Pico.*; | |
class Main | |
{ | |
static function main() | |
{ | |
onInit = init; |
NewerOlder