Skip to content

Instantly share code, notes, and snippets.

View ioleo's full-sized avatar
🌊
Fighting the tide...

ioleo ioleo

🌊
Fighting the tide...
View GitHub Profile
@ioleo
ioleo / sample.csv
Created April 29, 2023 12:42
Sample.csv
Marka Model Rok Wlasciciel
Skoda Octavia 2000 Mira
Kia Sorento 2022 Piotr
Skoda Felicia 1995 Waldek
Fiant Punto 2003 Marta
@ioleo
ioleo / add-certificate-to-java-cert-store.md
Last active January 20, 2022 10:45 — forked from ArturDorochowicz/add-certificate-to-java-cert-store.md
Adding a certificate to JRE trusted certificates stores.

Add certificate to JDK trusted certificates store

The default JDK store is in:

<JDK>\lib\security\cacerts

Add a certificate with keytool:

<JDK>\bin\keytool.exe -importcert -file my-cert.cer -alias 'My cert' -keystore <JDK>\lib\security\cacerts -storepass "changeit"
@ioleo
ioleo / CombiningTaglessHandlers.scala
Last active June 18, 2020 22:47
Example of free tagless combined handlers for module
import cats.data.IdT
import cats.{~>, Id, Monad}
import freestyle.tagless.logging.LoggingM
import freestyle.tagless._
import sourcecode.{File, Line}
@tagless trait Summer {
def sum(a: Int, b: Int): FS[Int]
}
@ioleo
ioleo / UseScrollPosition.scala
Created January 17, 2020 14:09 — forked from seamusv/UseScrollPosition.scala
ScalaJS facade for @n8tb1t/use-scroll-position
package ca.venasse.hooks
import org.scalajs.dom.html
import slinky.core.facade.ReactRef
import scala.scalajs.js
import scala.scalajs.js.JSConverters._
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.|
@ioleo
ioleo / SimpleFreestyleTagless.scala
Created January 26, 2018 12:19
Simple freestyle tagless program example with single instruction
import cats.data.State
import freestyle.tagless._
/* domain objects */
case class Id(id: String)
case class AcmeItem(id: Id)
/* state */
trait MapState[K, V] {
type Type = Map[K, V]
@ioleo
ioleo / GenericFreeAlgebra.scala
Last active January 23, 2019 08:48
Example of generic free algebra with Cats and Freestyle. Additional type args beyond F[_] in algebras are not currently supported. To work around we use path dependent types.
import cats.data.State
import freestyle.free._
/* domain objects */
sealed trait Acme
object Acme {
case object AcmeUK extends Acme
case object AcmeUS extends Acme
}
@ioleo
ioleo / TaglessModulesExample.scala
Last active January 23, 2019 08:48
Freestyle tagless program example with multiple algebras composed into module
import cats.Monad
import cats.effect.IO
import freestyle.tagless._
@tagless trait Logger {
def debug(message: String): FS[Unit]
}
@tagless trait Summer {
def sum(a: Int, b: Int): FS[Int]
@ioleo
ioleo / FreeModulesExample.scala
Last active January 23, 2019 08:48
Freestyle free program example with multiple algebras composed into module
import cats.effect.IO
import freestyle.free._
import freestyle.free.implicits._
@free trait Logger {
def debug(message: String): FS[Unit]
}
@free trait Summer {
def sum(a: Int, b: Int): FS[Int]
@ioleo
ioleo / ConfigReader.scala
Created January 29, 2018 20:08
Classy typesafe config reader utils
import classy.{DecodeError, Read}
import classy.config.ConfigDecoder
import com.typesafe.config.Config
import scala.util.{Failure, Success, Try}
object ConfigReader {
def apply[A](f: String => A): Read[Config, A] = { path =>
ConfigDecoder.instance[A] { config =>
Try(f(config.getString(path))) match {
@ioleo
ioleo / ZioScheduleTest.scala
Created September 18, 2018 07:21
Scalaz Zio Schedule test
import scalaz.zio._
import scalaz.zio.interop.future._
import scala.concurrent.{ ExecutionContext, Future }
import scala.concurrent.duration._
object ZioScheduleTest extends App {
var counter = 0
def futureF(): Future[Int] = {