This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface State<T_state extends State> { | |
void load(History<T_state> history, int lastTransaction); | |
} | |
public abstract class BaseState<T_state extends State> implements State<T_state> { | |
private int lastTransaction = -1; | |
@Override public void load(History<T_state> history, int lastTransaction) { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XMonad | |
import XMonad.Hooks.SetWMName | |
main = xmonad defaultConfig | |
{ modMask = mod4Mask -- Use WinKey instead of Alt | |
, startupHook = setWMName "LG3D" -- required so java apps like IntelliJ work (otherwise will get grey screen) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@game_predicate | |
def emergency(world): | |
# forgive the nasty | |
if world.alarm return True | |
if world.on_fire return True | |
if some other shit return True | |
return False | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// property slots.... get the extensibility of getters/setters along with the conciseness of the common case where they trivially wrap a field | |
class Slot<X> { | |
private X x; | |
public Slot(){this.x=null;} | |
private Slot(X x) { this.x=x; } | |
static <X> Slot<X> slot(X x){ return new Slot<>(x); } | |
static <X> Slot<X> slot(){ return new Slot<X>(null); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EZMap<T> { | |
public static void main(String[] args) { | |
Map<String,Object> m = hashMap( | |
bob -> 5, | |
TheGimp -> 8, | |
incredibleKoolAid -> "James Taylor", | |
heyArnold -> new Date() | |
); | |
System.out.println(m); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ var lastid=1; function mkid(){return 'r'+lastid++; } | |
function arrayP(x){ return typeof x === 'object' && Object.prototype.hasOwnProperty.apply(x,['length']); | |
} | |
function cat(){ var res=[], | |
args=Array.prototype.slice.apply(arguments); | |
while(args.length){ var snip = args.shift(); | |
console.log(snip); | |
if ( snip && arrayP(snip[0]) ) { | |
while(snip.length){ res.push(snip.shift()); } | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
function id(x){ return x; } | |
function cf(x){ return function(y) { return x; }; } | |
} | |
start | |
= sp V:fn { return (V(null))(2); } | |
sum | |
= L:term "+" sp R:sum { return function(x){ return L(x)+R(x); }; } |