Skip to content

Instantly share code, notes, and snippets.

View sprengerjo's full-sized avatar

Jonas sprengerjo

View GitHub Profile
@sprengerjo
sprengerjo / keybase
Last active March 25, 2020 15:26
keybase.md
### Keybase proof
I hereby claim:
* I am sprengerjo on github.
* I am sprengerjo (https://keybase.io/sprengerjo) on keybase.
* I have a public key ASA1R8bKPafq7TycNTQBmQU9ftqPS4H-R3mJ2g1DovXURwo
To claim this, I am signing this object:
@sprengerjo
sprengerjo / gist:5853372
Created June 24, 2013 20:32
bowling game generated java source
package de.sprengerjo.game.xtend;
import java.util.ArrayList;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.ExclusiveRange;
import org.eclipse.xtext.xbase.lib.Functions.Function0;
@SuppressWarnings("all")
public class Game {
private ArrayList<Integer> _scores = new Function0<ArrayList<Integer>>() {
@sprengerjo
sprengerjo / gist:5853355
Last active December 18, 2015 22:18
bowling game test and implementation
package de.sprengerjo.game.xtend
import static org.junit.Assert.*
import org.junit.Test
import org.junit.Before
class GameTest {
var game = new Game()
@Before
@sprengerjo
sprengerjo / gist:5853233
Created June 24, 2013 20:16
first test and first implementation
@Test
defvoid gutterGamesOnly() {
(1..20).forEach[game.roll(0)]
assertEquals(20 * 0, game.score())
}
// the implementation so far...
class Game {
def roll(int score) {
@sprengerjo
sprengerjo / gist:5853059
Created June 24, 2013 19:59
fluent functional
// pretty cool way of saying: sum ‘+’ all values stored in ‘scores’, a is the result of the previous iteration,
// b is the current value.
[ scores.reduce[a, b | a + b ]]
// You can also do something like this:
scores.forEach[value, index | println(value + "@" + index)]