Skip to content

Instantly share code, notes, and snippets.


Martin Lechner martinlechner1

View GitHub Profile
martinlechner1 /
Last active Aug 29, 2016 — forked from trey/
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global "Your Name"
git config --global ""
martinlechner1 / myfile.elm
Created Mar 15, 2017
Some random elm code to process a large list...
View myfile.elm
convertRecordsTask : Task Http.Error (List (List String)) -> Task Http.Error (List TrajectoryPoint)
convertRecordsTask task = convertRecords task
convertRecords : List (List String) -> List TrajectoryPoint
convertRecords records =
List.take 10000 records
|> convertRecord

Scala FP Material


  • Redbook
  • Advanced Scala with Cats
  • Functional Programming for Mortals

Blog Posts

View Sensor.ino
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <ArduinoJson.h>
const char* SSID = "ssid";
const char* PSK = "wifi key";
const char* MQTT_BROKER = "mqtt ip";
View buildTransactor.scala
private def buildTransactor(c: Connection): Resource[IO, Transactor[IO]] =
Blocker[IO].map { b =>
Transactor.fromConnection[IO](c, b)
private def prestoTransactor(): Resource[IO, Transactor[IO]] =
Resource.fromAutoCloseable[IO, Connection] {
IO.fromTry(Try {
val url = "jdbc:presto://your-presto-jdbc-url"
val properties = new Properties()
View transactorUse.scala
prestoTransactor().use { xa => queryProgram(xa) }.unsafeRunSync()
View sqlProgram.scala
def queryProgram(xa: Transactor[IO]) =
sql"""SELECT your_fields FROM your_table"""
.evalMap(d => IO(println(d)))
docker system prune -a --volumes
View ZIO
# ZIO usage
## ZLayer for dependency management
- Type safe
- Composable
- No Magic / No reflection (unlike Guice)
- Support for modeling failing dependencies (such as config loading)
## Module pattern