Skip to content

Instantly share code, notes, and snippets.

@ubourdon
ubourdon / Recrutement.scala
Last active March 20, 2023 20:52
Recrutement Presta pour Performance Immo
package performanceimmo
object Recrutement {
val presentation = s"""
| Ami(e)s sur Scala FR, si vous êtes intéressés, je recherche un(e) presta (freelance ou SSII) pour bosser dans mon équipe, pour une mission de long terme (minimum 6 mois mais surement 1 an voir plus) sur du `Scala2/3`, `Elm`, `ZIO[R,E,A]`, `CQRS/Eventsourcing`, `Elasticsearch` et plein d'autres trucs top.
| Tout ça en `Télétravail complet` (on se verra en vrai si vous êtes gentils (et que vous habitez pas trop loin) 😜).
| Nous pratiquons aussi le `DDD (Domain Driven Design)`, `l'eXtreme programming (Pair programming, TDD, ...)` et `Kanban`.
""".stripMargin
sealed trait ExternalSystemIds
object ExternalSystemIds {
/**
* Les informations qui permettent d'identifier le Client dans la base Harvest
* @param uid
* @param cabinet
*/
case class HarvestSync(uid: HarvestContactId, cabinet: HarvestCabinetId) extends ExternalSystemIds
}
@ubourdon
ubourdon / example.scala
Last active November 12, 2021 08:21
example sealed trait zio json
sealed trait UserFilterRight
object UserFilterRight {
case object FilterByMyUid extends UserFilterRight
case class FilterByUser(users: Seq[SafeUUID]) extends UserFilterRight
case object AllInCabinet extends UserFilterRight
case object CanSeeNothing extends UserFilterRight
}
/**
I need to encode and deocde with discriminator e.g
@ubourdon
ubourdon / either.scala
Created January 6, 2021 22:34
bicovariant either
package pi.prelude
import pi.prelude.either.\/._
import zio.ZIO
import zio.prelude.{Bicovariant, Covariant}
package object either {
sealed trait \/[+E, +A] { self =>
private final def map0[B](f: A => B): \/[E, B] =
self match {
package pi.prelude
import pi.prelude.either.\/._
import zio.ZIO
import zio.prelude.{Bicovariant, Covariant}
package object either {
sealed trait \/[+E, +A] { self =>
private final def map0[B](f: A => B): \/[E, B] =
self match {
@ubourdon
ubourdon / json.scala
Last active September 3, 2020 14:02
object A {
sealed trait LotLinkType
object LotLinkType {
case object Tenant extends LotLinkType
case object Owner extends LotLinkType
case object Landlord extends LotLinkType
}
implicit val TenantJsonFmt = jsonSerializeCaseObject(Tenant)
implicit val OwnerJsonFmt = jsonSerializeCaseObject(Owner)
@ubourdon
ubourdon / NonEmptyListMaxSizeJsonFmt.scala
Last active September 3, 2020 08:50
Erreur chelou de play-json qui ne trouve pas un formateur pourtant existant.
import domain.common.collection.{NonEmptyListMaxSizeExceeded, NonEmptyListMaxSizeNewType}
import domain.common.collection.NonEmptyListMaxSizeNewType.NEL_MaxSize_2
import play.api.libs.json._
object NonEmptyListMaxSizeJsonFmt {
import NonEmptyListJsonFmt.nonEmptyListJsonFmt
implicit def nonemptyListMaxSize_2_JsonFmt[A](implicit fmt: Format[A]) = new Format[NEL_MaxSize_2.List_[A]] {
override def writes(o: NonEmptyListMaxSizeNewType.NEL_MaxSize_2.List_[A]): JsValue = nonEmptyListJsonFmt[A].writes(NEL_MaxSize_2.rawValue(o))
@ubourdon
ubourdon / Main.hs
Created October 15, 2019 07:54
Test driver mongo en haskell
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ExtendedDefaultRules #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-
dependencies:
- base >= 4.7 && < 5
- mongoDB >= 2.5.0.0
- mtl
- split
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE DisambiguateRecordFields #-}
module Main where
import Data.Text
import Text.Read (readMaybe)
--import Network.Wai (responseLBS, Application)
@ubourdon
ubourdon / schedule.scala
Last active May 24, 2019 14:24
schedule ZIO into ZStream
package zio
/*
repeatElems repeats each element of the stream according to the schedule, so delays are placed in-between the elements
repeat just repeats the entire stream, so delays are placed between the streams
*/
package object schedule {
import scalaz.zio.clock.Clock
import scalaz.zio.{DefaultRuntime, IO, Schedule, UIO, ZIO}
import scalaz.zio.stream.{ZSink, ZStream}