Skip to content

Instantly share code, notes, and snippets.

View anissen's full-sized avatar

Anders Nissen anissen

View GitHub Profile
@anissen
anissen / gist:a0ed65bf146c7089893e
Created June 11, 2014 19:40
Haxe enum pattern matching
enum Tree<T> {
Leaf(v :T);
Node(l :Tree<T>, r :Tree<T>);
}
class Test {
static function main() {
var myTree = Node(
Leaf("foo"),
Node(
@anissen
anissen / Localization Strings
Last active August 29, 2015 14:05 — forked from steverichey/Localization Strings
Danish translation of "Don't Move"
Here's a list of the strings in the game (SPOILERS kinda):
A game by: Et spil af
Powered by: Kører på
Press left or right to start: Tryk venstre eller højre for at starte
Release left and right: Slip venstre og højre
to start: for at starte
to erase: for at slette
Touch left or right side to start: Tryk venstre eller højre side for at starte
Release both sides: Slip begge sider
// http://try.haxe.org/#fC600
// minmax: http://old.haxe.org/doc/snip/minimax_algorithm
// negamax: http://en.wikipedia.org/wiki/Negamax
class GameMove
{
public function new()
{
{
"folders":
[
{
"follow_symlinks": true,
"name": "PROJECT NAME",
"path": "/project/path"
},
{
"follow_symlinks": true,
@anissen
anissen / luxe_resources.md
Last active August 29, 2015 14:07
Luxe resources
@anissen
anissen / Test.hx
Created November 18, 2014 13:19
hscript test
class Test
{
public static function main() :Void {
var test = new Test();
test.run();
}
public function new() {
@anissen
anissen / gist:0f65cceeddf6c2dce486
Created March 24, 2015 14:54
Hexmage mermaid diagram
graph LR
subgraph User
Action(Action) --> ChangeState
UserEvents(Events)
end
subgraph Game
Commands(Commands) --> ChangeState(<b>Change State</b>)
ChangeState --> Events
Events(Events) --> Commands
@anissen
anissen / gist:bf234d34a1ab4e75c2f6
Created March 31, 2015 14:05
Markov text generator
class Markov {
var cache :Map<String, Array<String>>;
var words :Array<String>;
public function new() {
words = [];
cache = new Map<String, Array<String>>();
}
@anissen
anissen / Markov.hx
Created April 5, 2015 13:46
Markov chain text generator v2
class Markov {
var cache :Map<String, Array<String>>;
var starting_keys :Array<Array<String>>;
public function new() {
cache = new Map<String, Array<String>>();
starting_keys = [];
}
public function train(input :String) {
@anissen
anissen / coffeekup-processing.coffee
Created January 7, 2012 22:06
Pretty cool page (server included) using coffeekup, processing.js and node.js in less than 40 lines of code
kup = require 'coffeekup'
# Client-side web page with canvas and processing
webpage = kup.render ->
doctype 5
html ->
head ->
meta charset: 'utf-8'
title 'CoffeeKup Processing'
style '''body { background-image:url('http://icanhasnoise.com/1d0b07-4a2219/40x1500/4'); text-align: center; } header { font-family: 'Lobster Two', cursive; font-size: 28px; color: white; text-shadow: 3px 3px 3px brown; }'''
link rel: 'stylesheet', href: 'http://fonts.googleapis.com/css?family=Lobster+Two&v2'