Skip to content

Instantly share code, notes, and snippets.

View darkfrog26's full-sized avatar
🦊
Crazy like a fox

Matt Hicks darkfrog26

🦊
Crazy like a fox
View GitHub Profile
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())
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();
{
"biography": 5.0,
"gender": 2.0,
"company": 2.0,
"feeRange": 8.0,
"twitter": 5.0,
"completeAddress": 10.0,
"websites": {
"value": 5.0,
"max": 5
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 {
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]
import org.scalatest.{Matchers, WordSpec}
/**
* @author Matt Hicks <matt@outr.com>
*/
class BasicsSpec extends WordSpec with Matchers {
import Schema._
"Table" should {
"create successfully" in {
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)) {
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}
/**
@darkfrog26
darkfrog26 / ScalaRelational vs Slick Benchmark
Created July 14, 2015 02:13
ScalaRelational vs Slick Benchmark
[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
<html>
<head>
<title>Testing</title>
</head>
<body>
<div id="heading">Heading</div>
<div id="contents">
<div id="one"></div>
<div id="two"></div>
</div>