Skip to content

Instantly share code, notes, and snippets.

Yannick Grenzinger ygrenzinger

Block or report user

Report or block ygrenzinger

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 BoardImpl.kt
package board
import board.Direction.*
class SquareBoardImpl(private val size: Int, private val cells: List<Cell>) : SquareBoard {
constructor(width: Int) : this(width, createCells(width))
override val width: Int
get() = size
View MockkSlowness.kt
package com.kata.tetris
import io.mockk.every
import io.mockk.mockk
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
/*
<dependency>
View README.md

Tetris Kata

This kata is intended to simulate a game of Tetris.

The point of this kata to to provide a larger than trivial exercise that can be used to practice TDD. A significant portion of the effort will be in determining what tests should be written and, more importantly, written next.

Considerations:

  • Multi-threading should not be a consideration. This should be done in a single thread.
  • Drawing the board is a bonus feature, and is not required in order to solve the problem.
  • For the purpose of the kata we do not need a true "game loop". We simply need to implement the rules in such a way as to advance the game state.
View FooBarQix.java
package com.course.polytech;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class FooBarQix {
private static Map<Integer, String> NUMBER_2_STRING = new HashMap<>();
@ygrenzinger
ygrenzinger / Cell.kt
Created Mar 18, 2019
Kotlin Game of Life with JC Melikian
View Cell.kt
enum class Cell {
ALIVE {
override fun nextGeneration(neighbors: Int): Cell {
if (neighbors == 2 || neighbors == 3) return this
return DEAD
}
}, DEAD {
override fun nextGeneration(neighbors: Int): Cell {
if (neighbors == 3) return ALIVE
return this
@ygrenzinger
ygrenzinger / Day6.kt
Last active Dec 26, 2018
Advent of Code
View Day6.kt
import java.io.File
import java.util.*
import java.util.concurrent.atomic.AtomicInteger
data class Coordinate(val x: Int, val y: Int)
data class Point(val label: Int, val coordinate: Coordinate)
data class area(val associatedToPoint: Point, val size: Int = 0)
var seqId = AtomicInteger(1)
View Latencies.md

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
@ygrenzinger
ygrenzinger / Pitch.md
Last active Aug 2, 2018
CfP - La crise du logiciel n’est pas technique.
View Pitch.md

Si vous pensez qu’on ne sait toujours pas faire du logiciel, rassurez-vous ce n’est pas à cause de Javascript! Cette crise date même des années 70. Cependant notre communauté continuent de chercher des solutions techniques à cette crise. A un moment, ce fut UML et MDE, puis agilité et craft maintenant ce serait la programmation fonctionnelle et les types.

Malheureusement toutes ces solutions essayent de résoudre un problème qui serait local et compliqué alors que la création de la valeur par le logiciel est un problème complexe qui dépasse largement le cadre de l’équipe de développement. Dans cette présentation, j’aimerais partager avec vous ce constat, prendre de la hauteur et voir en quoi il va falloir comprendre que, oui le professionnalisme du dev est indispensable, mais la solution est en fait au niveau de l’organisation.

En clair, pour résoudre la crise du logiciel, il va falloir revoir les règles des systèmes qui produisent du logiciel.

@ygrenzinger
ygrenzinger / MonadExs.hs
Last active Jul 15, 2019
Functor -> Applicative -> Monad typeclasses
View MonadExs.hs
-- Two datatypes
data Optional a = Some a | Empty deriving (Eq, Show)
data Or a b = A a | B b deriving (Eq, Show)
-- functor instances
instance Functor Optional where
fmap f (Some a) = Some (f a)
fmap _ Empty = Empty
instance Functor (Or a) where
You can’t perform that action at this time.