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] Json4sJacksonSpec: | |
[info] Json4sJackson | |
[info] - should parse it 1,000 times (01) (713 milliseconds) | |
[info] - should parse it 1,000 times (02) (248 milliseconds) | |
[info] - should parse it 1,000 times (03) (84 milliseconds) | |
[info] - should parse it 1,000 times (04) (77 milliseconds) | |
[info] - should parse it 1,000 times (05) (73 milliseconds) | |
[info] - should parse it 1,000 times (06) (77 milliseconds) | |
[info] - should parse it 1,000 times (07) (62 milliseconds) | |
[info] - should parse it 1,000 times (08) (59 milliseconds) |
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.generic.CanBuildFrom | |
import scala.language.higherKinds | |
/** | |
* Returns the input collection without the biggest element. | |
*/ | |
def dropMax[A, T[A] <: Traversable[A]](coll: T[A])(implicit ord: Ordering[A], cbf: CanBuildFrom[_, A, T[A]]): T[A] = { | |
def streamWithoutMax(currentMax: A, listTail: Traversable[A]): Stream[A] = { | |
if (listTail.isEmpty) { | |
Stream.Empty | |
} else { |
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.io.RandomAccessFile | |
import java.nio.channels.FileChannel | |
import org.jboss.netty.buffer.{ByteBufferBackedChannelBuffer, ChannelBuffer, ChannelBuffers} | |
/** | |
* Maps a the filename to a memory mapped random access file across 1 or more buffers. | |
* Support files up to Long.MAX_VALUE. | |
* | |
* @param filename the file to map | |
* @param maxBufferSize the maximum number of bytes to map per buffer |
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 com.google.common.cache.CacheBuilder | |
import com.google.common.cache.CacheLoader | |
import com.google.common.cache.LoadingCache | |
import com.google.common.cache.Cache | |
object CacheUtil { | |
implicit def functionToCacheLoader[F, T](f: F => T) = { | |
new CacheLoader[F, T] { | |
def load(key: F) = f(key) | |
} |
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
#!/bin/bash | |
# | |
# Open a URL in Chrome after SSH'ing to the URL's host and setting up a SOCKS proxy. | |
if [ $# -ne 1 ] | |
then | |
echo "usage: browse-with-proxy.sh <URL>" | |
echo | |
echo "Opens the given URL in a browser using an SSH tunnel to the host as a proxy" | |
echo |
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 Status | |
sealed trait HasID extends Status | |
sealed trait NoID extends Status | |
case class User[S <: Status]( | |
firstName: String, | |
lastName: String, | |
age: Int, | |
createdAt: java.util.Date, | |
private val _id: Int = 0 |
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 dxf.macros | |
import scala.language.experimental.macros | |
import scala.reflect.macros.Context | |
import scala.swing._ | |
import scala.swing.Swing._ | |
import javax.swing._ | |
import javax.swing.tree.DefaultMutableTreeNode | |
object ShowTree { |
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 com.developerb.dropbot; | |
import com.developerb.dropbot.instrumentation.MethodInvocationTimingInterceptor; | |
import com.google.inject.AbstractModule; | |
import com.yammer.metrics.annotation.Timed; | |
import static com.google.inject.matcher.Matchers.annotatedWith; | |
import static com.google.inject.matcher.Matchers.any; | |
/** |
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 rapture.io._ | |
// Let's parse some JSON | |
val src: Json = Json.parse(""" | |
{ | |
"foo": "Hello world", | |
"bar": { | |
"baz": 42 | |
} | |
} |
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
--- | |
# file ruby.yml | |
- hosts: all | |
gather_facts: false | |
sudo: true | |
vars: | |
# Where to install rbenv | |
- rbenv_root: /usr/local/rbenv | |
# The version of Ruby to install |
OlderNewer