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 / flambe.js
Last active November 3, 2015 12:27
Custom flambe.js embed-script for JavaScript target only
/**
* Custom flambe embed for JavaScript-target only.
* Author: Mark Knol - http://blog.stroep.nl
*/
var flambe = {};
/**
* Embed a Flambe game into the page.
*
* @return True if the game was successfully embedded.
@markknol
markknol / Main.hx
Created May 21, 2015 19:04
Basic Haxe Dispatch example
package;
import haxe.web.Dispatch;
import haxe.web.Request;
import php.Lib;
/**
Dispatch Example
* Make sure `mod_rewrite` is enabled
* You can add any `doBla` in Routes and it becomes an url /bla
@markknol
markknol / AutoDisposer.hx
Last active August 29, 2015 14:21
AutoDisposer component for Flambe
package temple.components;
import flambe.Component;
/**
Dispose its owner entity after a given delay.
Example:
`myEntity.add(new AutoDisposer(5);`
Example with callback:
@markknol
markknol / change-condition-to-setter.md
Last active August 29, 2015 14:18
Trolling with others code. Never leave your computer.

instruction: look for condition in code like if (xx == yy) replace with if (xx = yy)

@markknol
markknol / try-haxe.md
Last active March 28, 2018 14:46
try haxe gists
@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';
@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 / Implementation.hx
Created September 9, 2014 08:32
Heartbeat component implementation
var _connection:SignalConnection;
override public function onStart()
{
// grap HeartBeat component somewhere in parent entities
var heartBeat = owner.getFromParents(HeartBeat);
// listen to it
_connection = heartBeat.beat.changed.connect(onBeatChanged);
@markknol
markknol / HeartBeat.hx
Last active August 29, 2015 14:06
HeartBeat component
package nl.stroep.games.components;
import flambe.animation.AnimatedFloat;
import flambe.Component;
import flambe.util.Value;
/**
* @author Mark Knol [http://blog.stroep.nl]
*/
class HeartBeat extends Component