Skip to content

Instantly share code, notes, and snippets.

View NickHeiner's full-sized avatar
💭
Wubba lubba dub dub!!

Nick Heiner NickHeiner

💭
Wubba lubba dub dub!!
View GitHub Profile
protected FullLevelEvent loadLevel(final long currentUserId, final PlayerDataEntity playerModel,
final int levelIndex) {
final LevelEvent levelEvent =
new LevelEvent(GameController.SERVER_LOAD_LEVEL, levelIndex, playerModel.getId());
levelEvent.setCurrentPlayerId(currentUserId);
levelEvent.setResponseKey("asd");
final FullLevelEvent fetchedLevel1 =
(FullLevelEvent) handler.handleEvent(new LevelEvent(levelEvent, levelIndex, playerModel
.getId()));
@NickHeiner
NickHeiner / gist:1979177
Created March 5, 2012 16:38
transactions via closures
getInvadeStartInstanceTransaction(long defendingPlayerId, long invadingPlayerId, Long defendingPlayerInstanceId, int defendingPlayerFloorCount) {
return new Transact<InstanceEntity>() {
@Override
public void run(DAOT daot) {
InstanceEntity instance =
defendingPlayerInstanceId != null
? daot.getInstanceEntity(defendingPlayerInstanceId)
: new InstanceEntity(defendingPlayerId, defendingPlayerFloorCount);
instance.addInvadingPlayer(invadingPlayerId);
instance.setCurrentFloor(invadingPlayerId, 0);
Initializing App Engine server
Mar 09, 2012 7:13:46 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Mar 09, 2012 7:13:47 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed C:\Users\Nick\Code\Corpionage Kiln\corp-gwt-ui\war\WEB-INF/appengine-web.xml
Mar 09, 2012 7:13:47 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed C:\Users\Nick\Code\Corpionage Kiln\corp-gwt-ui\war\WEB-INF/web.xml
Mar 09, 2012 7:13:47 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: jetty-6.1.x
Mar 09, 2012 7:13:51 PM com.google.apphosting.utils.jetty.JettyLogger info
@NickHeiner
NickHeiner / Main.java
Created March 13, 2012 21:58
Java compile time run time overloading
public class Main {
static class Root {}
static class Sub extends Root {}
public static void main(String[] args) {
foo(new Sub());
Root r = new Sub();
foo(r);
(* Simple trie to store strings by Nick Heiner <nth23@cornell.edu> *)
module CharMap = Map.Make(Char)
(* count of members of the set that end at this node * mapping from
next char => children *)
type trie = Node of int * trie CharMap.t
let empty = Node (0, CharMap.empty)
@NickHeiner
NickHeiner / plane.ml
Created March 29, 2012 19:17
a game about furries in space
type scalar = float
type point = scalar * scalar
type vector = point
let s_plus = failwith "Slippy, get back here"
let s_minus = failwith "Slippy, watch out, bogey on your tail"
let s_times = failwith "Whoah, help me!"
(* Nick Heiner *)
let data = Array.toList ("LLLQLLQLQLLLQLELLLLLQLLQQLLLQE".ToCharArray())
let transitionCounts =
let rec helper soFar = function
| [] -> soFar
| [hd] -> soFar
| first::((next::_) as tl) ->
let key = (first, next)
@NickHeiner
NickHeiner / viterbi.fsx
Created April 24, 2012 19:25
F# Implementation of Viterbi
(* Nick Heiner - Info 2950 PS9 *)
(* Viterbi algorithm, as described here: http://people.ccmr.cornell.edu/~ginsparg/INFO295/vit.pdf
priorProbs: prior probability of a hidden state occuring
transitions: probability of one hidden state transitioning into another
emissionProbs: probability of a hidden state emitting an observed state
observation: a sequence of observed states
hiddens: a list of all possible hidden states
@NickHeiner
NickHeiner / Queue.ml
Created April 29, 2012 22:54 — forked from 23Skidoo/Queue.ml
Purely functional queue in Ocaml
(* Nick Heiner <nth23@cornell.edu> *)
(* Adapted from https://gist.github.com/1347308 *)
(* The func_ prefix is to avoid confusion with OCaml's standard Queue. *)
(* from F# *)
let (|>) g f = f g
type 'a func_queue = Func_Queue of 'a list * 'a list
let empty = Func_Queue ([], [])
@NickHeiner
NickHeiner / angular.js
Created December 14, 2012 00:06
angular.js built from petebacondarwin's fork on the repeat branch
This file has been truncated, but you can view the full file.
/**
* @license AngularJS v1.1.2-c9d93708
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, document, undefined) {
'use strict';
////////////////////////////////////