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 / 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 / haxe.json
Last active January 28, 2020 18:31
vscode haxe snippets
{
/*
// Place your snippets for Haxe here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// \t, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
@markknol
markknol / toolbar.xml
Last active December 9, 2020 11:52
HaxeDevelop/FlashDevelop TortoiseGit buttons. Put this in your user config files > settings/Toolbar.xml
<button label="Git Sync" click="RunProcess" tag="$(Quote)C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe$(Quote);-command sync -path $(Quote)$(ProjectDir)$(Quote)" image="59" />
<button label="Git Pull" click="RunProcess" tag="$(Quote)C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe$(Quote);-command pull -path $(Quote)$(ProjectDir)$(Quote)" image="71" />
<button label="Git Push" click="RunProcess" tag="$(Quote)C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe$(Quote);-command push -path $(Quote)$(ProjectDir)$(Quote)" image="72" />
<button label="Git Commit" click="RunProcess" tag="$(Quote)C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe$(Quote);-command commit -path $(Quote)$(ProjectDir)$(Quote)" image="258" />
<button label="Git Commit (current file only)" click="RunProcess" tag="$(Quote)C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe$(Quote);-command commit -logmsg $(Quote)$(TypName)$(Quote) -path $(Quote)$(CurFile)$(Quote)" image="80" />
<button label="Git Switch" click="RunProc

replace (#123489) to github link

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

//replace:
\([$1$2]\(https://github.com/HaxeFoundation/haxe/issues/$2\)\)
@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"],
@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 / 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 / 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 / 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 / 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;
}