- Handling stacked monads and the like e.g.
List[Option[T]], `Future[Option[T]`` - Referentially transparent error handling
- Error accumulation/'parallel' validation
- Adding together
Option[T]s (a la http://stackoverflow.com/a/16319667, not sure how to word this well) - More explicitly typesafe collections (e.g. non-empty, guarantee that list.head never throws, etc)
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
| 2026 MLS Roster Composition | |
| A Major League Soccer club's active roster is comprised of up to 30 players. All 30 players are eligible for selection to the game-day squad during the regular season and playoffs. | |
| In addition to the Salary Budget, each MLS club may spend additional funds on player compensation including money from a League-wide allocation pool (General Allocation Money), discretionary amounts of Targeted Allocation Money, the cost of Designated Players outside the Salary Budget, the cost of U22 Initiative Slots outside the Salary Budget, and money spent on the Supplemental Roster (roster slots 21-31). | |
| Senior Roster | |
| Up to 20 players, occupying roster slots 1-20, count against the club's 2026 Salary Budget of $6,425,000 and are referred to collectively as the club's Senior Roster. | |
| Clubs are not required to fill roster slots 19 and 20, and clubs may spread their entire Salary Budget across 18 Senior Roster Players. A minimum Salary Budget Charge will be imputed against a club's Salary Budget |
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 java.io.InputStream | |
| import org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils | |
| import org.apache.spark.sql.{ DataFrame, Row } | |
| import org.postgresql.copy.CopyManager | |
| import org.postgresql.core.BaseConnection | |
| val jdbcUrl = s"jdbc:postgresql://..." // db credentials elided | |
| val connectionProperties = { |
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
| /** | |
| * Intersperses words with spaces and trims ends, accounts for basic smilies. | |
| */ | |
| def wordsToSentence(words: Vector[String]): String = { | |
| val punctuation = Set(":", ";", ".", ",", "!", "?") | |
| val smilies = Set(":)", ":(", ":<", ":}", ":|", ":o") | |
| // @TODO really bad implementation probably, clean this up later | |
| words.zipWithIndex.foldLeft("") { case (acc, (word, i)) => | |
| val isLastWordPairSmilie = if (words.isDefinedAt(i - 1)) { |
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._ | |
| object Server extends App { | |
| val system = ActorSystem("serverSystem") | |
| val serverActor = system.actorOf(Props(new ServerActor), name = "ServerActor") | |
| } | |
| class ServerActor extends Actor { | |
| def receive = { | |
| case message: String => |
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._ | |
| object Client extends App { | |
| val system = ActorSystem("clientSystem") | |
| val clientActor = system.actorOf(Props(new ClientActor), name = "ClientActor") | |
| clientActor ! SayHello | |
| } | |
| class ClientActor extends Actor { |
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
| # 'client' conf | |
| akka { | |
| actor { | |
| provider = "akka.remote.RemoteActorRefProvider" | |
| } | |
| remote { | |
| enabled-transports = ["akka.remote.netty.tcp"] | |
| netty.tcp { | |
| hostname = "127.0.0.1" | |
| port = 2553 |
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
| libraryDependencies ++= Seq( | |
| "com.typesafe.akka" %% "akka-actor" % "2.2.3", | |
| "com.typesafe.akka" %% "akka-remote" % "2.2.3" | |
| ) |