Skip to content

Instantly share code, notes, and snippets.

@JSantosP
JSantosP / TupleSum.scala
Created Jun 15, 2017
Scalera - Monoids aren't démodé and thursday are the new fridays
View TupleSum.scala
object TupleSum extends App {
// Monoids aren't démodé and thursday are the new fridays
val l = List(
1 -> 1,
2 -> 3,
3 -> 3)
//println(l.sum)
@JSantosP
JSantosP / card.scala
Last active Feb 2, 2017
Some cards gist
View card.scala
package scalera
package object card {
sealed trait Suit
object Suit {
lazy val values = List(Spades, Diamonds, Hearts, Clubs)
}
case object Spades extends Suit
case object Diamonds extends Suit
@JSantosP
JSantosP / TypeClassApproach.scala
Created Apr 7, 2016
Type class approach for polymorphic behavior
View TypeClassApproach.scala
object TypeClassApproach extends App {
// The logic ...
trait StreamT[T]{
def values: Stream[T]
}
object StreamT {
@JSantosP
JSantosP / Boot.scala
Created Apr 5, 2016
New Boot for twitter-stream project. With this snippet we're able to measure NRT the number of mentions between Android and IOS
View Boot.scala
package scalera.twitter
import org.apache.spark.streaming.dstream.DStream
import twitter4j.Status
object Boot extends Analytics{
// Set checkpoint dir
ssc.checkpoint("/tmp")
You can’t perform that action at this time.