This file contains hidden or 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
case class Count(val field: String) | |
def count: Parser[Count] = "select" ~ "count" ~> "(" ~> ident <~ ")" ^^ { | |
case exp => Count(exp) | |
} | |
//output: Count("name") |
This file contains hidden or 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 select: Parser[Select] = "select" ~ repsep(ident, ",") ^^ { | |
case "select" ~ f => Select(f: _*) | |
} | |
//output: Select(List[String]("name", "age")) |
This file contains hidden or 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 scala.util.parsing.combinator._ | |
import scala.util.parsing.combinator.syntactical._ | |
case class Select(val fields: String*) | |
case class From(val table: String) | |
def selectAll: Parser[Select] = "select" ~ "*" ^^^ (Select("*")) //output: Select("*") | |
def from: Parser[From] = "from" ~> ident ^^ (From(_)) //output: From("users") |
This file contains hidden or 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
case class Terms( | |
termIds: List[Int], | |
status: Int = 0) | |
case class DesiredTermDetails( | |
ancestors: Boolean = false, | |
category: Boolean = false, | |
children: Boolean = false, | |
translations: Boolean = true, | |
mappingSynonyms: Boolean = false, |
This file contains hidden or 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 spray.client.pipelining._ | |
import akka.actor.{ ActorRefFactory } | |
import spray.http._ | |
import spray.httpx._ | |
import scala.concurrent.Future | |
import scala.xml._ | |
class KeywordService(keywordServiceURL: String, implicit val actorRefFactory: ActorRefFactory) { | |
import actorRefFactory.dispatcher |
This file contains hidden or 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 esReindexActor = system.actorOf(Props(new ElasticsearchReIndexerActor( | |
"localhost:9200", | |
"localhost:9200", | |
"inputIndex", | |
"outputIndex", | |
"someType", | |
doNothing)), name = "esReIndexer") | |
esReindexActor ! "init" |
This file contains hidden or 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 org.json4s._ | |
import org.json4s.JsonDSL._ | |
import spray.client.pipelining._ | |
import spray.http._ | |
import spray.httpx._ | |
import spray.httpx.encoding._ | |
import scala.concurrent._ | |
import scala.concurrent.duration._ | |
import akka.actor._ | |
import scala.collection.mutable.ListBuffer |
This file contains hidden or 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
function check_rmq_version { | |
rmq_version=$(sudo rabbitmqctl status | grep "rabbit," | cut -d',' -f3 | cut -d'}' -f1 | tr -d '"') | |
echo && echo " Version = $rmq_version" && echo | |
} | |
function stop_rmq { | |
echo "Stopping RabbitMQ..." | |
sudo service rabbitmq-server stop | |
} |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
function usage { | |
echo >&2 "Usage: $0 [ -e environment -n service_name -a action ]" | |
exit 1 | |
} | |
while getopts ":n:e:a:" FLAG; do | |
case $FLAG in |
This file contains hidden or 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
/* | |
npm install async | |
npm install request | |
npm install fs | |
npm install shuffle-array | |
npm install string-format | |
usage: node index.js fileWithMasterIds.txt | |
*/ |