Skip to content
View FutureCollectWhile.scala
object FutureHelpers {
def collectWhile[A, B](in: Seq[Future[A]])(pf: PartialFunction[A, B])(implicit ec: ExecutionContext): Future[Seq[B]] =
collectWhileImpl(in, pf, Seq.newBuilder[B]).map(_.result())
private def collectWhileImpl[A, B](in: Seq[Future[A]], pf: PartialFunction[A, B], buffer: mutable.Builder[B, Seq[B]])(implicit ec: ExecutionContext): Future[mutable.Builder[B, Seq[B]]] =
if (in.isEmpty) {
Future.successful(buffer)
} else {
in.head flatMap {
View elastiс-example.json
echo '{
"query": {
"bool": {
"must": [
{ "terms": { "person": ["bob", "jake"] } },
{ "range": { "score": { "gt": 0 } } }
]
}
},
"aggs": {
View ContentType.scala
package eu.inn.forgame.api.rest
import spray.routing.Route
import eu.inn.util.akka.ActorSystemComponent
import eu.inn.util.http.RestServiceComponent
import eu.inn.util.servicebus.ServiceBusComponent
import eu.inn.datamodel.forgame.auth.IssueToken
import eu.inn.forgame.api.directives.{AuthProviderComponent, AuthUser}
View FlagsRegistry.scala
object FlagsRegistry {
private val flagsRegistry = new FlagsRegistry(config, dao, executorService)
def check(serviceId: Long, flag: FlagEnum) = flagsRegistry.check(serviceId, flag)
}
class FlagsRegistry(conf, dao, executorService) {
View spray-nginx.conf
server {
listen 80;
server_name localhost;
location / {
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
View AkkaReceiveAndReply.scala
package eu.inn.util.akka
import concurrent.Future
import concurrent.duration._
import scala.reflect.ClassTag
import util.control.NonFatal
import akka.actor._
import akka.util.Timeout
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View kibana-color-level.patch
diff --git a/src/app/panels/table/module.html b/src/app/panels/table/module.html
index b1aa49f..515ba06 100644
--- a/src/app/panels/table/module.html
+++ b/src/app/panels/table/module.html
@@ -52,6 +52,24 @@
padding: 10px;
border: 1px solid #666;
}
+ .table-field-level-error {
+ border-radius: 3px;
View example.py
l = ["1", "32", "hello", "3", "my 43"]
return [int(_) for _ in filter(lambda _: _.isdigit(), l)]
View es-scroll.scala
val timeout = new TimeValue(600000)
val requestBuilder = client
.prepareSearch(index)
.setTypes(indexType)
.setSize(size.getOrElse(5000))
.setScroll(timeout)
.setSearchType(SearchType.SCAN)
query foreach requestBuilder.setQuery
Something went wrong with that request. Please try again.