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
// C+P from https://github.com/nafg/slick-additions/blob/63de5af9c7791c5523865d362c27380e3d031b19/bintray.sbt | |
publishMavenStyle := true | |
publishTo := Some("Slick-additions Bintray" at "https://api.bintray.com/maven/naftoligug/maven/slick-additions") | |
sys.env.get("BINTRAYKEY").toSeq map (key => | |
credentials += Credentials( | |
"Bintray API Realm", | |
"api.bintray.com", |
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
+-----------------------------------------------------------------------------------------------------+ | |
| name | bits | bytes | min | actual min value | max | actual max value | | |
|---------+--------+--------+-------+----------------------------+--------+---------------------------| | |
| boolean | 1-bit | -- | false | | true | | | |
| byte | 8-bit | 1-byte | -2^7 | -128 | 2^7-1 | 127 | | |
| short | 16-bit | 2-byte | -2^15 | -32'768 | 2^15-1 | 32'767 | | |
| char | 16-bit | 2-byte | 0 | '\u0000' | 2^16-1 | '\uffff' (65535) | | |
| int | 32-bit | 4-byte | -2^31 | -2'147'483'648 | 2^31-1 | 2'147'483'647 | | |
| long | 64-bit | 8-byte | -2^63 | -9'223'372'036'854'775'808 | 2^63-1 | 9'223'372'036'854'775'807 | | |
| float | 32-bit | 4-byte | +/- -3.4028235 * 10^38 | +/- 3.4028235 * 10^38 |
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 dependencyList = taskKey[File]("") | |
val dependencyListDef = Def.task { | |
val f = baseDirectory.value / "deps.sbt.txt" | |
streams.value.log.info(s"Writing to $f") | |
IO.write(f, "\n") | |
IO.append(f, "The following files have been resolved:\n") | |
val cp = (managedClasspath in Test).value | |
val lines = cp map { att => | |
val md = att.metadata |
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
def buildTimestampSuffix = ";build.timestamp=" + new java.util.Date().getTime | |
val localArtifactoryRelease = "local-artifactory-release" at "http://localhost:8081/artifactory/libs-release" | |
val localArtifactorySnapshot = "local-artifactory-snapshot" at "http://localhost:8081/artifactory/libs-snapshot" | |
val localArtifactoryReleaseLocal = "local-artifactory-release-local" at "http://localhost:8081/artifactory/libs-release-local" | |
def localArtifactorySnapshotLocal = "local-artifactory-snapshot-local" at "http://localhost:8081/artifactory/libs-snapshot-local" + buildTimestampSuffix | |
val localArtifactoryCreds = Credentials("Artifactory Realm", "localhost", "admin", "password") | |
// credentials += localArtifactoryCreds |
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
domain.com vs www.domain.com | |
301 Moved Permanently | |
302 Found | |
GET http://google.com -> 302 http://www.google.co.uk | |
GET http://www.google.com -> 302 http://www.google.co.uk | |
GET https://google.com -> 302 https://www.google.co.uk | |
GET https://www.google.com -> 302 https://www.google.co.uk |
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
lo/hi | |
enc/dec | |
fst/snd | |
get/put/del | |
new/add/mod/del/(rem) | |
old/new | |
req/rsp | |
src/dst | |
usr/pwd |
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 akka.actor.{ Actor, ActorRef, ActorSystem, Props } | |
import scala.reflect.ClassTag | |
object CrossActorSystemMessageTest { | |
def main(args: Array[String]): Unit = { | |
val fooActorSystem = ActorSystem("foo") | |
val barActorSystem = ActorSystem("bar") | |
val foo = fooActorSystem.mkActor("fooActor", new Foo) |
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
def nowIso8601() = { | |
val df = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") | |
df setTimeZone (java.util.TimeZone getTimeZone "UTC") | |
df format new java.util.Date() | |
} |
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.{ByteArrayOutputStream, PrintStream} | |
import java.security.MessageDigest | |
/** Identifies throwables by creating checksums (like MD5 or SHA1) of its stacktrace. */ | |
object ErrId { | |
/** Returns the absolute checksum of the specified throwable. */ | |
def absolute(t: Throwable): String = { | |
val bytes = stackBytes(t) | |
val md = sha1er |
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
def digest(in: InputStream, md: MessageDigest): Array[Byte] = { | |
val buffer = new Array[Byte](0x1000) | |
@tailrec | |
def loop(count: Int): Array[Byte] = { | |
if (count == -1) | |
md.digest | |
else { | |
md.update(buffer, 0, count) | |
loop(in read buffer) | |
} |