This file contains 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
trait MyOption[A] { | |
def fold[B](n: => B, s: A => B): B | |
// Define the usual Option API. | |
// | |
// * Constructors (on the object) | |
// some | |
// none | |
// * methods | |
// map |
This file contains 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
object DatomicPricing { | |
object Schema extends VersionedSchemaComponent("0.0.1") { | |
object ns { | |
val pricing = new Namespace("Pricing") | |
} | |
val isIndexed = true | |
val isComponent = true | |
val quoteId = Attribute(ns.pricing / "QuoteId", SchemaType.string, Cardinality.one).withUnique(Unique.identity) |
This file contains 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
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE RoleAnnotations #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} |
This file contains 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
# In case you had some strange python installation | |
# NOTE: .pydistutils.cfg seems to be not compatible with brew install python | |
# areas I needed to clean before installation | |
# clean up ~/Library/Python | |
# clean up .local | |
# preconditions: | |
# xcode with command line tools installed | |
xcode-select --install |
This file contains 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
object ServerSparkContext { | |
private[this] lazy val _sqlContext = { | |
val conf = new SparkConf() | |
.setAppName("....") | |
val sc = new SparkContext(conf) | |
// TODO: Bug in Spark: http://stackoverflow.com/questions/30323212 | |
val ctx = new HiveContext(sc) | |
ctx.setConf("spark.sql.hive.convertMetastoreParquet", "false") |
This file contains 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
object InstantInsanity extends App { | |
type Cube = Seq[Char] | |
val cubes: Seq[Cube] = Seq("BGWGBR", "WGBWRR", "GWRBRR", "BRGGWW").map(_.toSeq) | |
// Rotate a cube 90 degrees over its Z-axis, leaving up and down in place. | |
def rot: Cube => Cube = { case Seq(u, f, r, b, l, d) => Seq(u, r, b, l, f, d) } | |
// Twist a cube around the axis running from the upper-front-right |
This file contains 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
object InstantInsanity extends App { | |
// scalastyle:off | |
def undefined[T]: T = ??? | |
def ⊥[T]: T = undefined | |
trait R | |
trait G | |
trait B |
OlderNewer