I hereby claim:
- I am jruusu on github.
- I am jruusu (https://keybase.io/jruusu) on keybase.
- I have a public key ASC83N5RGYbiDybp1XMjikjP_FEhruFljc-sQbVKorOrGgo
To claim this, I am signing this object:
// Play 2.4 Specs2 Mockito mocked method answers with multiple arguments | |
import org.specs2.matcher.ThrownExpectations | |
import org.specs2.mock.Mockito | |
import play.api.test.{FakeRequest, WithApplication, PlaySpecification} | |
class MySpec extends PlaySpecification { | |
class MySpecScope extends WithApplication with Mockito with ThrownExpectations { | |
val programService = mock[ProgramService] |
I hereby claim:
To claim this, I am signing this object:
import play.api.libs.functional.syntax._ | |
import play.api.libs.json._ | |
case class Foo(id: String, bar: Option[Bar]) | |
object Foo { | |
implicit val format = Json.format[Foo] | |
} | |
case class Bar(id: String, foos: Option[Seq[Foo]]) | |
object Bar { |
Example: stubbing a service object in a Rails application
app/models/services/sharepoint.rb (partial):
module SharePoint
# Live SharePoint Context class, uses OAuth2 and RestClient
# to talk to the outside world
class LiveContext
// By extending Boolean | |
// See: http://docs.scala-lang.org/overviews/core/value-classes.html#extension-methods | |
implicit class PimpedBoolean(val self: Boolean) { | |
def toOption[T](x: => T): Option[T] = if (self) Some(x) else None | |
} | |
true toOption "foox" // => Some(foox) | |
true toOption { | |
println("garglex") | |
"foox" |
#!/usr/bin/env bash | |
# | |
# Set docker dns options dynamically on a Ubuntu 16.04 host | |
# | |
# See: | |
# https://github.com/docker/docker/issues/541 | |
# https://docs.docker.com/engine/admin/systemd/ | |
# http://stackoverflow.com/questions/33784295/setting-dns-for-docker-daemon-on-os-with-systemd | |
# | |
set -eui |
See: https://github.com/jacobalberty/unifi-docker
sudo groupadd unifi
sudo usermod -aG unifi $USER
sudo useradd --system --gid unifi unifi