Skip to content

Instantly share code, notes, and snippets.

Avatar

Jim O'Flaherty chaotic3quilibrium

View GitHub Profile
@chaotic3quilibrium
chaotic3quilibrium / Effective Scala Case Class Patterns.md
Last active Oct 6, 2022
Article: Effective Scala Case Class Patterns - The guide I wished I had read years ago when starting my Scala journey
View Effective Scala Case Class Patterns.md

Effective Scala Case Class Patterns

Version: 2022.03.02

Available As

@chaotic3quilibrium
chaotic3quilibrium / org.public_domain.PurelyFunctionalHangman.scala
Last active Jan 27, 2021
An update of John deGoes original PurelyFunctionalHangman to ZIO 1.0
View org.public_domain.PurelyFunctionalHangman.scala
package org.public_domain
import zio.console._
import zio.{ExitCode, UIO, URIO, ZIO}
import java.io.IOException
object PurelyFunctionalHangman extends zio.App {
def run(args: List[String]) : URIO[Console, ExitCode] =
hangman.exitCode
@chaotic3quilibrium
chaotic3quilibrium / Stage01.scala
Created May 5, 2020
ScalaBoi: Posting a Twitter Thread of Tweets - Stage 1 - Create the Webpage App Backbone
View Stage01.scala
import scalatags.JsDom.all._
val textAreaInput =
textarea.render
val buttonExecuteTransform =
button("Execute Transform").render
val textAreaOutput =
textarea.render
@chaotic3quilibrium
chaotic3quilibrium / TheTenDivisibilities.scala
Created Apr 24, 2020
ScalaBoi: A John Conway Puzzler - Part 1 of 2 - Oops, That Didn't Work! Why?!
View TheTenDivisibilities.scala
//C1 - Initial Scala solution attempt
val lettersToDigitsPrefixSize = 3
val letterToDigits =
List(
'a' -> List(1, 3, 7, 9),
'b' -> List(2, 4, 6, 8),
'c' -> List(1, 3, 7, 9),
'd' -> List(2, 4, 6, 8),
@chaotic3quilibrium
chaotic3quilibrium / org.public_domain.scrabble.Bag.scala
Last active Jun 28, 2016
Java Code Challenge: Scrabble Sets - Scala Solution
View org.public_domain.scrabble.Bag.scala
package org.public_domain.scrabble
import scala.util.{Success, Failure, Random, Try}
object Bag {
//copy and paste directly from provided URL at "Tile count and value ordered by count"
// with "Blank" replaced with "_":
// http://scrabblewizard.com/scrabble-tile-distribution/
private val countByTileFull =
"""E 12 1
@chaotic3quilibrium
chaotic3quilibrium / DIY Scala Enumeration - README.txt
Last active Sep 13, 2020
DIY Scala Enumeration (closest possible Java Enum equivalent with guaranteed pattern matching exhaustiveness checking)
View DIY Scala Enumeration - README.txt
README.txt - DIY Scala Enumeration
Copyright (C) 2014-2016 Jim O'Flaherty
Overview:
Provide in Scala the closest equivalent to Java Enum
- includes decorating each declared Enum member with extended information
- guarantees pattern matching exhaustiveness checking
- this is not available with scala.Enumeration
ScalaOlio library (GPLv3) which contains more up-to-date versions of both `org.scalaolio.util.Enumeration` and `org.scalaolio.util.EnumerationDecorated`: