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 / 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 / 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 / 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 / handbook.md
Last active October 27, 2015 09:14
Macro Field build handbook

Build property with inline getter

Virtually adds this property to a class:

public function myVar(get, null):Float;
private inline function get_myVar():Float {
	return 1.5;
}

@markknol
markknol / MainTest.hx
Last active November 9, 2015 21:40
Flambe - 9-slice example drawing http://projects.stroep.nl/flambe-9slice/
package urgame;
import flambe.animation.Sine;
import flambe.asset.Manifest;
import flambe.Entity;
import flambe.System;
class MainTest {
private static function main () {
System.init();
@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 / runner.js
Last active August 26, 2019 08:14
Google chrome dino game runner hack - add screenshakes ( chrome://dino )
// open F12, paste this in the console. screenshakes!!
window.oldJump = Runner.instance_.tRex.startJump
Runner.instance_.tRex.startJump = function() {
window.oldJump.call(Runner.instance_.tRex, null);
for(i=0;i<30;i++) {
setTimeout(function() {
Runner.instance_.tRex.canvas.style.marginTop = (-10+Math.random()*20) + "px";
Runner.instance_.tRex.canvas.style.marginLeft = (-10+Math.random()*20) + "px";
}, 500 + i * 10);
}
@markknol
markknol / browser-support-table.md
Last active July 11, 2020 15:50
Browser support table in markdown

Table

Chrome Firefox IE Opera Safari
Latest ✔ Latest ✔ 10+ ✔ Latest ✔ 6.1+ ✔

Code

![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png)
@markknol
markknol / color-palettes.hx
Created May 13, 2016 10:58
Color palette array
var palette = [["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],
["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],
["#ECD078","#D95B43","#C02942","#542437","#53777A"],
["#556270","#4ECDC4","#C7F464","#FF6B6B","#C44D58"],
["#774F38","#E08E79","#F1D4AF","#ECE5CE","#C5E0DC"],
["#E8DDCB","#CDB380","#036564","#033649","#031634"],
["#490A3D","#BD1550","#E97F02","#F8CA00","#8A9B0F"],
["#594F4F","#547980","#45ADA8","#9DE0AD","#E5FCC2"],
["#00A0B0","#6A4A3C","#CC333F","#EB6841","#EDC951"],
["#E94E77","#D68189","#C6A49A","#C6E5D9","#F4EAD5"],

replace (#123489) to github link

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

//replace:
\([$1$2]\(https://github.com/HaxeFoundation/haxe/issues/$2\)\)