Skip to content

Instantly share code, notes, and snippets.

View 8bitreid's full-sized avatar
🖖

Reid Mewborne 8bitreid

🖖
View GitHub Profile
@8bitreid
8bitreid / HelloZioWithSimpleLayer.scala
Last active October 26, 2022 00:07
Simple ZLayer Example
package example
import zio.{IO, Layer, Task, ULayer, ZIO, ZIOAppDefault, ZLayer}
// Main
object ZioApp extends ZIOAppDefault:
val app: Task[Unit] =
ZIO.serviceWithZIO[GreetingService](_.sayHello)
.provideLayer(GreetingModule.helloLayer)
def run: Task[Unit] = app
def findMax(xs: List[String], index: Int): Char = {
xs.groupBy(line => line(index)).maxBy(map => map._2.length)._1
}
def lifeSupportRating(report: List[String]): Int = {
val oxygenPred: (Char, Char) => Boolean = (left, right) => left == right
val co2Pred: (Char, Char) => Boolean = (left, right) => left != right
@tailrec
def filterUntil(ratings: List[String], index: Int)(pred: (Char, Char) => Boolean): String = {
@8bitreid
8bitreid / JavaClassLanchHelperFix.md
Last active March 18, 2024 17:20
IntelliJ Class JavaLaunchHelper is implemented in both: Fix

Issue:

When running a scala or java project I get this message, even though the project still compiles and runs.

objc[1069]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java (0x1009ba4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x101b064e0). One of the two will be used. Which one is undefined

Fix:

  1. Open > Project Structure
  2. Edit > Remove the current JDK
  3. click the + button in the top left. then click JDK
  4. Then Select your JDK. In my case it was /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home