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 java.util.UUID | |
import scala.util.Random | |
import java.util.concurrent.ThreadLocalRandom | |
import scala.annotation.tailrec | |
/** | |
* @author Matt Hicks <matt@outr.com> | |
*/ | |
object Unique { | |
private val r = new Random(ThreadLocalRandom.current()) |
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
new tag.HTML { | |
clazz := List("no-js") | |
lang := "en-US" | |
contents += new tag.Head { | |
contents += new tag.Meta(httpEquiv = "X-UA-Compatible", content = "IE=11; IE=10; IE=9; IE=8; IE=EDGE") { | |
} | |
contents += new tag.Script(mimeType = "text/javascript") { | |
contents += JavaScriptString("/*") | |
contents += JavaScriptString("""*/ | |
var _sf_startpt=(new Date()).getTime(); |
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
{ | |
"biography": 5.0, | |
"gender": 2.0, | |
"company": 2.0, | |
"feeRange": 8.0, | |
"twitter": 5.0, | |
"completeAddress": 10.0, | |
"websites": { | |
"value": 5.0, | |
"max": 5 |
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 AAttribute | |
trait A extends HTMLTag { | |
def href: Attribute[String] with AAttribute | |
def target: Attribute[Target] with AAttribute | |
} | |
case class ImmutableA(attributes: Seq[AAttribute], children: Seq[HTMLTag]) extends A | |
class MutableA { |
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.mutable.ListBuffer | |
import scala.io.Source | |
import scala.util.Random | |
/** | |
* @author Matt Hicks <matt@outr.com> | |
*/ | |
object Test { | |
def main(args: Array[String]): Unit = { | |
var quotes = ListBuffer.empty[String] |
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 org.scalatest.{Matchers, WordSpec} | |
/** | |
* @author Matt Hicks <matt@outr.com> | |
*/ | |
class BasicsSpec extends WordSpec with Matchers { | |
import Schema._ | |
"Table" should { | |
"create successfully" in { |
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
private def link(l1: List[String], l2: List[String]) = { | |
def findClosest(v: String) = l2.foldLeft((Int.MaxValue, ""))((current, item) => LevenshteinMetric.compare(v, item).getOrElse(Int.MaxValue) match { | |
case i if i <= current._1 => (i, item) | |
case _ => current | |
}) | |
var items = Map.empty[String, String] | |
l1.foreach(v1 => findClosest(v1) match { | |
case (score, v2) => { | |
if (items.valuesIterator.contains(v2)) { |
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
package org.scalarelational.h2 | |
import java.util.concurrent.atomic.AtomicInteger | |
import org.powerscala.concurrent.Time | |
import org.scalarelational.column.property.{NotNull, Unique, AutoIncrement, PrimaryKey} | |
import org.scalarelational.model.Table | |
import org.scalatest.{Matchers, WordSpec} | |
/** |
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
[info] Result "srUpdate": | |
[info] 65.054 ±(99.9%) 14.119 ms/op [Average] | |
[info] (min, avg, max) = (55.011, 65.054, 77.015), stdev = 9.339 | |
[info] CI (99.9%): [50.936, 79.173] (assumes normal distribution) | |
[info] Samples, N = 10 | |
[info] mean = 65.054 ±(99.9%) 14.119 ms/op | |
[info] min = 55.011 ms/op | |
[info] p( 0.0000) = 55.011 ms/op | |
[info] p(50.0000) = 60.050 ms/op | |
[info] p(90.0000) = 76.990 ms/op |
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
<html> | |
<head> | |
<title>Testing</title> | |
</head> | |
<body> | |
<div id="heading">Heading</div> | |
<div id="contents"> | |
<div id="one"></div> | |
<div id="two"></div> | |
</div> |
OlderNewer