Add to ~/.ssh/config
Host github.com-foo
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_foo
Host github.com-bar
HostName github.com
no_funs({M, _}) -> | |
{M,length(M:module_info(exports))}. | |
max_funs({Lm,Lsize},{Rm,Rsize}) -> | |
case Lsize =< Rsize of | |
true -> {Rm,Rsize}; | |
false -> {Lm,Lsize} | |
end. | |
largest_module(Modules) -> |
object MagnetExample extends App { | |
sealed trait AdditionMagnet { | |
type Result | |
def apply():Result | |
} | |
object AdditionMagnet { |
Add to ~/.ssh/config
Host github.com-foo
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_foo
Host github.com-bar
HostName github.com
val examinePattern: (String, String, String) => String = { | |
case (pattern, "", _) => pattern | |
case (pattern, tail, orig) if tail.take(pattern.length) == pattern => | |
examinePattern(pattern, tail.drop(pattern.length), orig) | |
case (pattern, _, orig) => | |
examinePattern(orig.take(pattern.length + 1), orig, orig) | |
} | |
val runEp : String => String = |
import scala.reflect.ClassTag | |
//ClassTag will make type info available that is erased by the JVM at runtime | |
def filterT[T :ClassTag](t:Any) : Boolean = t match { | |
case _:T => true | |
case _ => false | |
} | |
val anyL = List(1,"fe", 2, 3, 'a') |
Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x
package co.brightcog.validation | |
import arrow.core.* | |
import arrow.data.* | |
import arrow.typeclasses.* | |
sealed class Failure { | |
data class EmptyString(val fieldName: String) : Failure() | |
data class InvalidCity(val fieldName: String) : Failure() |
[error] /.../src/test/scala/admin/repository/ProductServiceSqlTest.scala:18:14: type mismatch; | |
[error] found : cats.effect.Resource[cats.effect.IO,doobie.hikari.HikariTransactor[cats.effect.IO]] | |
[error] (which expands to) cats.effect.Resource[cats.effect.IO,doobie.util.transactor.Transactor[cats.effect.IO]{type A = com.zaxxer.hikari.HikariDataSource}] | |
[error] required: cats.effect.Resource[F,doobie.hikari.HikariTransactor[F]] | |
[error] (which expands to) cats.effect.Resource[F,doobie.util.transactor.Transactor[F]{type A = com.zaxxer.hikari.HikariDataSource}] | |
[error] xa <- transactor(dbConf) | |
[error] ^ | |
[info] cats.effect.Resource[cats.effect.IO,doobie.hikari.HikariTransactor[cats.effect.IO]] <: cats.effect.Resource[F,doobie.hikari.HikariTransactor[F]]? | |
[info] F[_] <: cats.effect.IO[_]? | |
[info] false |
I've been working with Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥
import arrow.Kind | |
import arrow.core.Either | |
import arrow.fx.IO | |
import arrow.fx.ForIO | |
import arrow.fx.Queue | |
import arrow.fx.Timer | |
import arrow.fx.fix | |
import arrow.fx.handleErrorWith | |
import arrow.fx.QueueShutdown | |
import arrow.fx.extensions.fx |