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
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
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
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
+-----------------------------------------------------------------------------------------------------+ | |
| 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
// 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
import scalaz.\/ | |
import scalaz.concurrent.Task | |
import scala.concurrent.{ ExecutionContext, Future, Promise } | |
import scala.util.Try | |
class TaskCompat(private val T: Task.type) extends AnyVal { | |
def fromScala[A](future: Future[A])(implicit ec: ExecutionContext): Task[A] = | |
Task async (handlerConversion andThen future.onComplete) |
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
// Quasiquoted excerpt | |
def cdef = q""" | |
class $ClassName[..$classTypeParams](..$primaryParams) extends ..$classParents { | |
..$primaryAccessors | |
def get = this | |
def isEmpty = ${quasi.isEmpty} | |
def copy(..$primaryWithDefaults) = $ObjectName(..$primaryNames) |
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
final case class MapWithTabularLite[K, V](private val xs: TraversableOnce[(K, V)]) extends AnyVal { | |
def showkv() = if (xs.nonEmpty) { | |
val len = xs.toIterator.map(_._1.toString.length).max | |
val fmt = s"%${len}s %s" | |
xs foreach (kv => println(fmt format (kv._1, kv._2))) | |
} | |
} | |
final case class MultimapWithTabularLite[K, V](private val xs: TraversableOnce[(K, TraversableOnce[V])]) extends AnyVal { | |
def showkvs() = if (xs.nonEmpty) { |
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
class Thingy(val unThingy: String) extends AnyVal | |
class Rocket(val unRocket: Thingy) extends AnyVal |