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 / 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 / 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 / Main.hx
Created December 28, 2019 10:51 — forked from jdonaldson/Main.hx
Paths example
class Main {
static function main(){
var router = Paths.buildRouter(Page);
var o = router(["Home"]);
trace(o + " is the value for o");
var p = router(["Foo","Baz", "1"]);
trace(p + " is the value for p");
@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 / DateUtil.hx
Last active June 12, 2019 13:54
DateUtil Outputs "xx days/weeks/days/minutes/seconds ago" https://try.haxe.org/#21f31
class DateUtil {
public static function format(target:Date) {
var secondsInMs = 1000;
var minuteInMs = secondsInMs * 60;
var hourInMs = minuteInMs * 60;
var dayInMs = hourInMs * 24;
var targetTime = target.getTime();
var now = Date.now().getTime();
# FD UI THEME (5.3+)
# Use themes in dialogs?
SmartForm.UseTheme=True
# Should we use custom border?
ThemeManager.UseCustomBorder=True
# Apply even if set to None?
ThemeManager.ForceBorderStyle=False
@markknol
markknol / LutShader.hx
Created March 19, 2019 09:21
LUT shader (uses 512x512 textures)
class LutShader extends h3d.shader.ScreenShader {
static var SRC = {
@param var texture : Sampler2D;
@param var lookup1 : Sampler2D;
@param var lookup2 : Sampler2D;
@param var mixAmount : Float = 0.0;
@param var totalMixAmount : Float = 1.0;
function calcLookup(color:Vec4, lookupTexture:Sampler2D):Vec4 {
var blueColor = color.b * 63.0;
@markknol
markknol / Main.hx
Created September 21, 2018 13:30
Rainbow colors
function getRainbow(size:Int) {
inline function sinToHex(i, phase) {
var sin = Math.sin(Math.PI / size * 2 * i + phase);
var int = Math.floor(sin * 127) + 128;
return StringTools.hex(int, 2);
}
return [for (i in 0...size) {
var red = sinToHex(i, 0 * Math.PI * 2/3);
var blue = sinToHex(i, 1 * Math.PI * 2/3);
var green = sinToHex(i, 2 * Math.PI * 2/3);
@markknol
markknol / Publish to Haxelib using Travis.md
Last active July 17, 2018 20:06
Publish to Haxelib (using Travis) using Github Releases

Publish to Haxelib using Travis using Github Releases

This tutorial will help you publish your library automatically to lib.haxe.org when you create a release on GitHub.

Motivation

  • Collaborators on GitHub can help publish on haxelib without the need of sharing/knowing your password.
  • It automatically tests your project, this ensures you don't publish broken builds.
  • It makes sure you have tagged your projects because that's what GitHub does for you when doing a release.
  • It is more transparent for collaborators/users what goes into the haxelib package zip file.
@markknol
markknol / Life.hx
Created May 25, 2018 09:15
Life = life
package com.mediamonks.game.state;
import flambe.Component;
import flambe.util.Value;
/**
* Life.
*
* To follow the clues and walk out the exit.
* To know and master the world.