I hereby claim:
- I am eboto on github.
- I am eremboto (https://keybase.io/eremboto) on keybase.
- I have a public key ASBkbr-l6twgzlKwkAlYx38wSQsEy-Dn_t0qAL1w7UPaXQo
To claim this, I am signing this object:
// If you create a Future inside another Future, the inner one | |
// will not log exceptions thrown in its body to the console. | |
// | |
// Why not? | |
// | |
// Example: | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.Future | |
val fut = Future { |
I hereby claim:
To claim this, I am signing this object:
A rough proposal to implement the widely desired pub/sub feature on ipfs without requiring additional capabilities or message-passing behavior from the network or the clients. It could be implemented as an IPFS application right now.
I've just started diving into IPFS so this could be a super naïve approach.
The proposal's core concepts:
# Proposed poor-man's IPFS/IPNS pubsub | |
A rough proposal to implement the widely desired [pub/sub feature on ipfs](https://github.com/ipfs/notes/issues/64) | |
without requiring additional capabilities or message-passing behavior from the network or the clients. It could be | |
implemented as an IPFS application right now and in fact I've got sample JS that uses the js-http-api to do so | |
on the publish side. Hopefully building out the subscribe side this week. | |
I've just started diving into IPFS so this could be a super naïve approach. | |
The proposal's core concepts: |
case class User(id: Long, name: String) | |
case class ZipCode(userId: Long, zipCode: String) | |
trait Error { | |
def message: String | |
} | |
case class UserError(message: String) extends Error | |
case class ZipError(message: String) extends Error | |
/* |
Sample directory structure and file-contents for a one-module, one-app play
build. It illustrates how routes compilation and resolution might work in a way that
avoids namespace collision on the controllers.routes
symbol (a bug in Play 2.0.x).
The initial version of this gist demonstrates the behavior of the pull request that solves that bug, authored by @jroper:
Though this solves a pretty huge problem in our company, the reverse router
syntax is a bit unsatisfying due to the awkward syntax of module reverse routes:
controllers.module.module.routes.Module
package controllers | |
import play.api._ | |
import play.api.mvc._ | |
import play.api.mvc.Results._ | |
/** Imagine that the stuff inside this package is the toybox plugin code */ | |
package toybox { | |
/** |
package assetproviders { | |
import play.api.mvc.Action | |
import play.api.mvc.Controller | |
import play.api.mvc.AnyContent | |
import play.api.mvc.Call | |
/** | |
* This simple interface is meant to mimic the existing interface in Play 2.0 | |
* for the Assets controller it provides. By implementing this it is possible | |
* to mix and combine various AssetProviders to create a custom Asset controller |
// This is not a particularly impressive example of using futures. | |
def getMetrics: List[EgraphsMetric[Int]] = { | |
import akka.pattern.{ ask, pipe } | |
val futureMetrics: List[Future[EgraphsMetric[Int]]] = for (actor <- actors: List[ActorRef]) yield { | |
implicit val timeout = Timeout(5 seconds) | |
for { | |
metric <- ask(actor, GetMetric).mapTo[EgraphsMetric[Int]] |
trait MyService { | |
def metricProvider: OtherService1 | |
// My work goes below | |
def getMetrics: Seq[Metric] { | |
// code that actually uses dep1 and dep2 to get metrics | |
} | |
} | |
object MyService extends MyService { |