Skip to content

Instantly share code, notes, and snippets.

Dan Korostelev nadako

Block or report user

Report or block nadako

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nadako
nadako / 1 Main.hx
Last active Aug 11, 2019
ocaml-like `with` for Haxe
View 1 Main.hx
using WithMacro;
typedef Player = {
final name:String;
final level:Int;
}
class Main {
static function main() {
var player = {name: "Dan", level: 15};
@nadako
nadako / tasks.json
Created Aug 29, 2016
tasks.json from Haxe with OCaml problem matcher
View tasks.json
{
"version": "0.1.0",
"command": "make",
"isShellCommand": true,
"args": ["ADD_REVISION=1", "-f", "Makefile.win", "haxe"],
"showOutput": "always",
"problemMatcher": {
"fileLocation": "relative",
"owner": "ocaml",
"pattern": [
View building-haxe-ng-plus.md

NOTE: This gist was added to the official building manual and will be updated there from now on: https://haxe.org/documentation/introduction/building-haxe.html

Preparation

  • Uninstall OCaml, MinGW, Cygwin
  • Remove leftover environment vars, cleanup PATH

Installation

View Component.hx
// register a build-macro that will be called
// for building fields for subclasses of this class
@:autoBuild(ComponentMacro.build())
class Component {
// this function will be overriden in subclasses
public function registerCallbacks(updates:Array<Void->Void>) {}
}
View FunctionArgMacro.hx
import haxe.macro.Context;
import haxe.macro.Expr;
class FunctionArgMacro {
macro static function build():Array<Field> {
var fields = Context.getBuildFields();
for (field in fields) {
switch (field.kind) {
case FFun(fun):
var checks = [];
@nadako
nadako / tasks.json
Created Apr 19, 2016
haxe problem matcher for vs code
View tasks.json
{
"version": "0.1.0",
"command": "haxe",
"args": ["build.hxml"],
"problemMatcher": {
"owner": "haxe",
"pattern": {
"regexp": "^(.+):(\\d+): (?:lines \\d+-(\\d+)|character(?:s (\\d+)-| )(\\d+)) : (?:(Warning) : )?(.*)$",
"file": 1,
"line": 2,
@nadako
nadako / 0_reuse_code.js
Created Apr 12, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View Main.hx
@:jsRequire("remote")
extern class Remote {
static function require(module:String):Dynamic;
}
extern class BrowserWindow {
function new();
}
@:jsRequire("browser-window")
View Main.hx
class Main {
static function main() {
var s = new Signature<Int->Void>();
}
}
You can’t perform that action at this time.