This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.pollpass.experimental | |
import cats.data.ValidatedNec | |
object Example1 { | |
def run(): Unit = { | |
type Checker = Char => Boolean | |
val isBraille: Checker = _ => false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final case class SimpleCache() { | |
private def tempDir(key: String): IO[Path] = | |
IO.fromTry(Try(System.getProperty("java.io.tmpdir")).map(s => Paths.get(s, key))) | |
private def serialize[V](path: Path)(v: V): Unit = { | |
val out = new ObjectOutputStream(new FileOutputStream(path.toString)) | |
out.writeObject(v) | |
out.close() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.server.Directives._ | |
import cats.effect.{IO, IOApp, Resource} | |
import cats.syntax.all.catsSyntaxMonadErrorRethrow | |
import ch.megard.akka.http.cors.scaladsl.CorsDirectives.cors | |
import com.google.cloud.texttospeech.v1.TextToSpeechClient | |
import com.typesafe.scalalogging.LazyLogging | |
object Boot extends IOApp.Simple with LazyLogging { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require('assert'); | |
describe('should-work', () => { | |
it('passes', () => { | |
const enhanceURL = (url) => | |
url.replace(/https/g, 'http').replace(/^http:\/\/([a-zA-Z0-9]+)\./gm, | |
(m, p1) => m.replace(p1, 'admin--' + p1)) | |
.replace(/\/(?=[^\/]*$)/, '/api/') | |
+ '?_content_format=json' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[syntax trees at end of parser]] // HelloWorld2.scala | |
package <empty> { | |
object HelloWorld2 extends scala.AnyRef { | |
def <init>() = { | |
super.<init>(); | |
() | |
}; | |
def main(args: Array[String]): Unit = { | |
val add2: _root_.scala.Function1[Int, Int] = ((x$1) => x$1.$plus(2)); | |
println(StringContext("Hello world! This is Scala. ", "").s(add2(40))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object HelloWorld extends App { | |
val add2: Int => Int = _ + 2 | |
println(s"Hello world! This is Scala. ${add2(40)}") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.effect._ | |
import cats.implicits._ | |
import java.io.PrintWriter | |
import java.nio.file.Path | |
object Editor { | |
type Editor = String | |
sealed trait EditorError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Oto Brglez - <[email protected]> - May 2021 | |
package com.pinkstack.gen4 | |
import cats.effect.implicits._ | |
import cats.effect.{ExitCode, IO, IOApp} | |
import cats.implicits._ | |
import com.pinkstack.gen1.CoinMarketCap.Implicits._ | |
import com.pinkstack.gen1.CoinMarketCap._ | |
import sttp.client3._ | |
import sttp.client3.circe._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: Oto Brglez | |
// - https://www.twitch.tv/otobrglez | |
// - https://twitter.com/otobrglez | |
import org.apache.commons.math3.distribution.EnumeratedDistribution | |
import org.apache.commons.math3.util.Pair | |
import scala.jdk.CollectionConverters._ | |
import scala.util.Random | |
object Generator { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* HttpClient that uses Scala Cats, Circe and some caching for Akka and Akka Http. | |
* Author: Oto Brglez | |
*/ | |
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.model._ | |
import akka.http.scaladsl.model.headers.RawHeader | |
import akka.http.scaladsl.unmarshalling.Unmarshal | |
import better.files.Dsl._ |