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
{ | |
"default": { | |
"server": { | |
"binary": "binary", | |
"mongo": "mongodb://localhost:27017/ems", | |
"root": "/server/" | |
}, | |
"crypt": { | |
"password": "changeme", | |
"type": "DES" |
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
GET /foo?input=invalid HTTP/1.1 | |
Host: example.com | |
Accept: application/vnd.collection+json,*/* | |
HTTP/1.1 400 Bad Request | |
Content-Type: application/vnd.collection+json | |
{ | |
"error": { | |
"title": "Expected int in input", |
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 java.net.URI | |
object Main extends App { | |
val list = List((1, URI.create("hello"), "hello", 23.2), (2, URI.create("bye"), "bye", 45.2)) | |
val (ints, uris, strings, doubles) = list.unzip4 | |
println(ints) | |
println(uris) | |
println(strings) | |
println(doubles) |
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
trait JsonParser extends BodyParserModule { | |
def parse[String, O <: Parser[O]](a: String)(implicit Parser: O): O = a match { | |
case Parser(o) => o | |
case _ => ??? | |
} | |
} | |
sealed trait Parser[A] { | |
def parse(a: String): A |
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
{ | |
"template": { | |
"data": [ | |
{"name": "title", "value": "FOOO"}, | |
{"name": "level", "value": "advanced"}, | |
{"name": "format", "value": "presentation"}, | |
{"name": "body", "value": "Abstract ...."}, | |
{"name": "summary", "value": "Something something"}, | |
{"name": "audience", "value": "FOOO"}, | |
{"name": "outline", "value": "FOOO"}, |
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
package rpm; | |
import org.freecompany.redline.ReadableChannelWrapper; | |
import org.freecompany.redline.Scanner; | |
import org.freecompany.redline.header.Format; | |
import org.freecompany.redline.payload.CpioHeader; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileOutputStream; |
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
package unfilteredx.kit | |
import unfiltered.request._ | |
import unfiltered.response._ | |
object Secure { | |
def secure[A,B](intent: unfiltered.Cycle.Intent[A,B]): unfiltered.Cycle.Intent[A,B] = { | |
case req@ForwardedProto(proto) if (intent.isDefinedAt(req)) => intent(wrap(req, proto.toLowerCase)) | |
case req if (intent.isDefinedAt(req)) => intent(req) | |
} |
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
public class Main { | |
public static void main(String[] args) { | |
HTTPClientResponseResolver resolver = HTTPClientResponseResolver.createMultithreadedInstance(); | |
HttpClient client = resolver.getClient(); | |
HttpConnectionManagerParams params = client.getConnectionManager().getParams(); | |
params.setDefaultMaxConnectionsPerHost(5); | |
params.setMaxTotalConnections(20); | |
} |
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
sealed trait Score { | |
def isEmpty = this match { | |
case SetScore(_, _) => false | |
case NoScore => true | |
} | |
def isDefined = !isEmpty | |
def toOption: Option[(Int, Int)] = this match { | |
case NoScore => None |
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
interface Session { | |
String getId(); | |
} |