Skip to content

Instantly share code, notes, and snippets.

View fteychene's full-sized avatar

Francois Teychene fteychene

View GitHub Profile

Keybase proof

I hereby claim:

  • I am fteychene on github.
  • I am fteychene (https://keybase.io/fteychene) on keybase.
  • I have a public key ASBN34zfHMRt8MGbJiGbgEgnsvgys9UFVaJRi89tf9YYmgo

To claim this, I am signing this object:

Bowling Rules

The game consists of 10 frames.
In each frame the player has two rolls to knock down 10 pins.
The score for the frame is the total number of pins knocked down, plus bonuses for strikes and spares.

A spare is when the player knocks down all 10 pins in two rolls.
The bonus for that frame is the number of pins knocked down by the next roll.

A strike is when the player knocks down all 10 pins on his first roll.

@fteychene
fteychene / StreamInputStream.kt
Last active May 16, 2019 10:04
InputStream to combine a Stream of other InputStream in a lazy way in Kotlin
class StreamInputStream(private val source: Stream<out InputStream>) : InputStream() {
private val iterator by lazy {
source
.flatMap {
generateSequence {
val result = it.read(); if (result == -1) {
it.close(); null
} else result
}.asStream()
@fteychene
fteychene / build.gradle
Created June 17, 2019 12:41
Helios sealed classes encoder/decoder test
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.31'
}
apply plugin: 'kotlin-kapt' //optional
group 'io.saagie.playground'
version '1.0-SNAPSHOT'
repositories {
@fteychene
fteychene / Cargo.toml
Last active April 20, 2020 17:34
Test multi runtime and spwn_blocking in Tokio
[package]
name = "test_multi_runtime"
version = "0.1.0"
authors = ["fteychene <[email protected]>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.28"
@fteychene
fteychene / build.gradle.kts
Created April 28, 2020 13:57
Basic Zipper in Kotlin with Arrow
plugins {
kotlin("jvm") version "1.3.72"
kotlin("kapt") version "1.3.41"
}
group = "xyz.fteychene.kotlin.sample"
version = "0.1.0-SNAPSHOT"
@fteychene
fteychene / gameoflife.kt
Created April 30, 2020 07:51
GameOfLife TypeDD and Sequence test
package mtpcraft.tdd.kata
import kotlin.random.Random
sealed class Cell {
companion object
}
object Dead : Cell()
object Living : Cell()
@fteychene
fteychene / build.gradle
Last active October 14, 2020 09:00
Arrow fx coroutine play on Chuck Norris facts
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.10'
}
apply plugin: 'kotlin-kapt'
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
[package]
name = "lolilol"
version = "0.1.0"
authors = ["fteychene <[email protected]>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
lol-core = "0.7.1"