Skip to content

Instantly share code, notes, and snippets.

D. Galdos galdosd

Block or report user

Report or block galdosd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View es.java
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) {
}
}
View xmonad.hs
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)
}
View tabular_events.py
@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
View property_slots.java
// 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); }
View Pretty Map Literals for Java 8
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);
}
View gist:2394221
{ 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 {
View lambdaness.peg
{
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); }; }
You can’t perform that action at this time.