View worksheet.scala
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
val code = """def html[X, Y](xs: List[(X, Y)]) = xs.toString | |
val a = List((1,1)) | |
a | |
val b = List((1,1)) | |
b""" | |
val tree = tb.parse(code) | |
val identifiers = tree.children.collect{ case i @ Ident(_) => i } | |
val instrumentation = identifiers.map{ i => | |
Apply(Select(Ident("scala"), TermName("Tuple2")), |
View styles.less
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
// props: https://github.com/soloman1124/atom-solo-dark-ui | |
::-webkit-scrollbar { | |
width: 8px; | |
height: 8px; | |
} | |
::-webkit-scrollbar-track, | |
::-webkit-scrollbar-corner { | |
background: rgba(42, 42, 42, 0.5); | |
} |
View gist:9c0c79a2468af211724b
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 TC { | |
trait Ser[In, Out] { | |
def ser(in: In): Out | |
} | |
implicit object StringString extends Ser[String, String] { | |
def ser(a: String) = a | |
} | |
} |
View sol.scala
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
import scala.util.Try | |
val nl = System.lineSeparator | |
def gliff(xs: String) = { | |
xs.stripMargin.split(nl).to[List] | |
} | |
val gliffs = | |
Map( |
View build.sbt
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
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value |
View ordering.scala
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
sealed trait Node[T] | |
case class Leaf[T](v: T) extends Node[T] | |
case class Branch[T](l: Node[T], r: Node[T]) extends Node[T] | |
implicit def nodeOrdering[W, C](implicit num: Numeric[W]): Ordering[Node[(W, C)]] = { | |
def weight(a: Node[(W, C)]): Tuple2[W, C] = a match { | |
case Leaf((w, c)) => (w, c) | |
case Branch(l, r) => { | |
val (wl, cl) = weight(l) | |
val (wr, _) = weight(r) |
View MillionDollarHomepage.scala
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
/*** | |
scalaVersion := "2.11.2" | |
resolvers ++= Seq( | |
"Sonatype" at "https://oss.sonatype.org/content/repositories/releases", | |
"spray repo" at "http://repo.spray.io" | |
) | |
libraryDependencies ++= Seq( | |
"io.spray" %% "spray-client" % "1.3.2-20140909", |
View uri.scala
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
case class Uri( | |
scheme: String, user: Option[String], host: String, port: Option[Int], | |
path: List[String], query: List[String]) | |
object Uri { | |
def unapply(uri: String): Option[Uri] = { | |
scala.util.Try(new java.net.URI(uri)).map{ v => | |
Some(new Uri(v.getScheme, Option(v.getUserInfo), v.getHost, Option(v.getPort), | |
v.getRawPath.split("/").to[List], v.getRawQuery.split("&").to[List])) | |
}.getOrElse(None) |
View xmonad.hs
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
-- | |
-- xmonad example config file for xmonad-0.9 | |
-- | |
-- A template showing all available configuration hooks, | |
-- and how to override the defaults in your own xmonad.hs conf file. | |
-- | |
-- Normally, you'd only override those defaults you care about. | |
-- | |
-- NOTE: Those updating from earlier xmonad versions, who use | |
-- EwmhDesktops, safeSpawn, WindowGo, or the simple-status-bar |
View TTFI.scala
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 TTFI { | |
import scala.language.higherKinds | |
object Initial { | |
// {{{ OOP | |
object OOP { | |
// extending language is easy, adding more functions is hard since it | |
// involves having to modify each case class | |
trait Exp[A] { |
OlderNewer