Skip to content

Instantly share code, notes, and snippets.

View markknol's full-sized avatar
🧪
Doodling around

Mark Knol markknol

🧪
Doodling around
View GitHub Profile
@markknol
markknol / Example.hx
Last active December 25, 2015 06:29
Nape Debug View in Haxe Flambe
//You can use it like this:
System.root.add(new NapeDebugView());

replace (#123489) to github link

// find:
\((#)(.+?)\)

//replace:
\([$1$2]\(https://github.com/HaxeFoundation/haxe/issues/$2\)\)
@markknol
markknol / ExternalUtil.hx
Created September 17, 2014 12:59
Native alert/prompt/confirm message for Flambe
package temple.utils;
import flambe.System;
/**
* @author Mark Knol [http://blog.stroep.nl]
*/
class ExternalUtil
{
#if air
public static var airBrowser:AirBrowser = new AirBrowser();
@markknol
markknol / IsMobile.hx
Last active March 1, 2017 00:01
Haxe type definitions for isMobile checks https://github.com/kaimallea/isMobile
/**
* Type definitions for <https://github.com/kaimallea/isMobile>
* Don't forget to add the actual script in the head of the html.
*
* @author Mark Knol
*/
@:native("isMobile")
extern class IsMobile
{
public static var apple(default,null):{phone:Bool, ipod:Bool, tablet:Bool, device:Bool};
@markknol
markknol / MacroJsonValidator.hx
Created December 4, 2015 13:23
Macro - validate a JSON compiletime
/**
* @author Mark Knol
*/
class MacroJsonValidator {
public static macro function validateJson(path:String) {
if (sys.FileSystem.exists(path)) {
var content = sys.io.File.getContent(path);
try {
// Test the json by parsing it.
// It will throw an error when you made a mistake.
@markknol
markknol / CSVReader.hx
Last active October 2, 2017 14:48
Haxe CSV Parser / Reader
using StringTools;
class CSVReader
{
private static var format:CSVFormat = { del: ",", quote: '"', escape: '""', linedel: "\r\n" };
private var csv:String;
public function new(csv:String)
{
this.csv = csv;
@markknol
markknol / Main.hx
Last active January 2, 2018 08:54
Heaps Nape
package game;
import h2d.Bitmap;
import h2d.Sprite;
import hxd.Res;
import nape.geom.Vec2;
import nape.phys.Body;
import nape.phys.BodyType;
import nape.shape.Polygon;
import nape.space.Space;
@markknol
markknol / empty-haxe-project-size.md
Last active January 8, 2018 16:11
Empty Haxe project size

Size of empty Haxe/JavaScript project

openfl kha heaps pixi.js
normal 1027kb 358kb 1460kb 1250kb
closure 533kb 181kb 829kb 415kb

Used compiler: Haxe 3.4.2


@markknol
markknol / commands.md
Created January 25, 2018 22:10
Haxe.org git commands

Update Haxe Manual submodule

cd manual && git checkout master && git pull && cd .. && git commit -am "update manual"

Put from staging to master

git checkout master && git pull && git pull origin staging --rebase && git push && git checkout staging
@markknol
markknol / Main.hx
Last active January 25, 2018 22:18
Console Log Viewer for haxe development
class Main {
static function main() {
addConsoleLogViewer();
}
public static inline function addConsoleLogViewer(align = "bottom", minimized = true, totalItems = 45) {
#if consolelogviewer
var script = js.Browser.document.createScriptElement();
script.type = "text/javascript";
script.src = 'https://markknol.github.io/console-log-viewer/console-log-viewer.js?align=$align&minimized=$minimized';