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 TestCaseClass(cost: Float, other1: Int, other2: String, other3: String) | |
val r = new scala.util.Random(31) | |
val tenkList = 1 to 10000 map (_ => TestCaseClass(r.nextFloat(), r.nextInt, r.alphanumeric.take(3).mkString, "")) | |
val millionList = 1 to 1000000 map (_ => TestCaseClass(r.nextFloat(), r.nextInt, r.alphanumeric.take(3).mkString, "")) | |
val tenMillionList = 1 to 10000000 map (_ => TestCaseClass(r.nextFloat(), r.nextInt, r.alphanumeric.take(3).mkString, "")) | |
def time[R](block: => R): Long = { | |
val t0 = System.currentTimeMillis() | |
block | |
val t1 = System.currentTimeMillis() |
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.collection.concurrent | |
import scala.collection.immutable._ | |
val concurrentTrieMap: concurrent.Map[String, String] = concurrent.TrieMap.empty | |
var immutableMap: Map[String, String] = Map.empty | |
var hashMap: HashMap[String, String] = HashMap.empty | |
def time[R](block: => R): String = { | |
val t0 = System.nanoTime() |
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
- Abstract class vs trait | |
- how does traits prevent the diamond problem | |
- Algebraic data types over options | |
- Cake pattern, why you shouldn't use it | |
- extends product with serializable | |
- case object, case class vs object, class | |
- value classes | |
- type classes | |
- Monads of the standard library | |
- Option |
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
#! /usr/bin/env python | |
""" Convert values between RGB hex codes and xterm-256 color codes. | |
Nice long listing of all 256 colors and their codes. Useful for | |
developing console color themes, or even script output schemes. | |
Resources: | |
* http://en.wikipedia.org/wiki/8-bit_color | |
* http://en.wikipedia.org/wiki/ANSI_escape_code |