Skip to content

Instantly share code, notes, and snippets.

View Rafailong's full-sized avatar
🤠

ravila Rafailong

🤠
  • Mexico
View GitHub Profile
version = "3.5.3"
maxColumn = 100
runner.dialect = scala3
style = defaultWithAlign
align.openParenCallSite = false
align.openParenDefnSite = false
continuationIndent.callSite = 2
continuationIndent.defnSite = 2
spaces.inImportCurlyBraces = false
project.excludeFilters = [".*\\.sbt"]
/**
* Given two words, we can determine if they have the same vowels,
* ignoring order and repetition.
*
* For instance, “Hello” and “Vowel” both have \e and \o, so they have the same vowels.
*
* Write a function that groups words into “families” that all have the same vowels.
* “Tree” and “tent” also belong to the same family because we ignore the repetition of \e.
*
* Examples
@Rafailong
Rafailong / balanced_paren_cluster.worksheet.sc
Created November 16, 2021 20:17
Balanced Paren Clusters
import $scalac.`-Ypartial-unification`
import $dep.`org.typelevel::cats-core:2.3.0`
import scala.collection.immutable._
import cats.Foldable
import cats.implicits._
/**
* Balanced Paren Clusters
(*
Atbash Cipher
The Atbash Cipher is simple: replace every letter with its “mirror” in the alphabet.
A is replaced by Z. B is replaced by Y. Etc. Write a function to calculate it.
Examples
(atbash "") ;=> ""
(atbash "hello") ;=> "svool"
@Rafailong
Rafailong / five.scala
Created April 16, 2019 15:38
path to fp - partial function applicaiton
val addCurried: Int => Int => Int = (add _).curried
print(addCurried(1)(2))
@Rafailong
Rafailong / one.scala
Created March 22, 2019 17:45
path to fp - currying
// base function
def add(a: Int, b: Int): Int = a + b
// curried form
def addCurried(a: Int)(b: Int): Int = a + b
/**
* In scala functions have the method `curried`
*/
val addCurriedTwo = (add _).curried
@Rafailong
Rafailong / DockerKafkaService.scala
Created February 28, 2019 15:50
Integration Tests in sbt projects.
package me.rafaavila
import com.whisk.docker._
trait DockerKafkaService extends DockerKit {
def KafkaAdvertisedPort = 9092
val ZookeeperDefaultPort = 2181
lazy val kafkaContainer = DockerContainer("spotify/kafka")
@Rafailong
Rafailong / fpmax.scala
Created August 2, 2018 15:19 — forked from jdegoes/fpmax.scala
FP to the Max — Code Examples
package fpmax
import scala.util.Try
import scala.io.StdIn.readLine
object App0 {
def main: Unit = {
println("What is your name?")
val name = readLine()
@Rafailong
Rafailong / init.coffee
Last active June 21, 2017 16:48
atom editor sync-settings
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
// run this in VsCode command palette
// F#
ext install Ionide.ionide-fsharp
ext install Ionide.ionide-fake
ext install Ionide.ionide-paket
// varia
ext install nwolverson.ide-purescript
ext install UCL.haskelly