Skip to content

Instantly share code, notes, and snippets.

View thealmikey's full-sized avatar
🎯
Focusing

Michael Gikaru thealmikey

🎯
Focusing
View GitHub Profile

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@meoyawn
meoyawn / client.kt
Last active April 14, 2019 10:46
CLI instant messenger in 60 lines with ZMQ
package chat
import org.zeromq.ZMQ
import kotlin.concurrent.thread
fun main(args: Array<String>): Unit =
ZMQ.context(1).use { ctx ->
thread {
ctx.socket(ZMQ.SUB).use { stream ->
stream.connect(MESSAGE_STREAM)
@densh
densh / Snake.scala
Last active December 19, 2021 05:05
Snake game in 200 lines of Scala Native and SDL2 as demoed during Scala Matsuri 2017
import scalanative.native._
import SDL._
import SDLExtra._
@extern
@link("SDL2")
object SDL {
type Window = CStruct0
type Renderer = CStruct0
@michael-simons
michael-simons / Application.kt
Last active February 18, 2024 10:55
Minimal Kotlin/Gradle Example for Neo4j OGM
package so
import org.neo4j.ogm.annotation.GeneratedValue
import org.neo4j.ogm.annotation.Id
import org.neo4j.ogm.annotation.NodeEntity
import org.neo4j.ogm.annotation.Relationship
import org.neo4j.ogm.config.Configuration
import org.neo4j.ogm.session.SessionFactory
@NodeEntity