This file contains 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
mime = { | |
MIMEType: function MIMEType(major, minor, attributes) { | |
this.major = major || "*"; | |
this.minor = minor || "*"; | |
this.attributes = attributes || []; | |
}, | |
Parameter : function(name, value) { | |
this.name = name; | |
this.value = value || ""; | |
} |
This file contains 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
private static Map<CaseInsensitiveKey, HTTPMethod> defaultMethods = ImmutableMap.<CaseInsensitiveKey, HTTPMethod>builder() | |
.put(new CaseInsensitiveKey(CONNECT.getMethod()), CONNECT) | |
.put(new CaseInsensitiveKey(DELETE.getMethod()), DELETE) | |
.put(new CaseInsensitiveKey(GET.getMethod()), GET) | |
.put(new CaseInsensitiveKey(HEAD.getMethod()), HEAD) | |
.put(new CaseInsensitiveKey(OPTIONS.getMethod()), OPTIONS) | |
.put(new CaseInsensitiveKey(PATCH.getMethod()), PATCH) | |
.put(new CaseInsensitiveKey(POST.getMethod()), POST) | |
.put(new CaseInsensitiveKey(PURGE.getMethod()), PURGE) | |
.put(new CaseInsensitiveKey(PUT.getMethod()), PUT) |
This file contains 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 Message(origin: Option[Origin], command: NameAndFormat, arguments: List[String]) { | |
def format = { | |
val builder = new StringBuilder() | |
origin.foreach(x => builder.append(":").append(x.name).append(" ")) | |
command match { | |
case Status(c, n) => builder.append(c) | |
case Command(n) => builder.append(n) | |
} | |
builder.append(" ") |
This file contains 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
<?xml version="1.0"?> | |
<service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"> | |
<workspace> | |
<atom:title type="text">spaces</atom:title> | |
<collection href="http://localhost:1990/confluence/rest/atompub/latest/spaces"> | |
<atom:title type="text">spaces</atom:title> | |
<accept/> | |
<categories fixed="yes"> | |
<category xmlns="http://www.w3.org/2005/Atom" scheme="urn:confluence:category" term="page"/> | |
<category xmlns="http://www.w3.org/2005/Atom" scheme="urn:confluence:category" term="space"/> |
This file contains 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 com.example.util | |
import java.net.URI | |
case class RichURI(uri: URI) { | |
def getLastPathSegment = { | |
val uriAsString = uri.toString | |
val index = uriAsString.lastIndexOf("/") | |
if (index != -1) { | |
Some(uriAsString.substring(index + 1)) |
This file contains 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
2. Pandoc Constructs | |
What do you need to type in Pandoc to get the correct output. Note | |
this is just basic Pandoc format, so you might be better off reading | |
the README from Pandoc itself [15]. | |
2.1. section | |
Just use the normal sectioning commands available in Pandoc, I tend | |
to use |
This file contains 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
object HerokuRedirect { | |
def apply[A, B](req: HttpRequest[A], path: String): ResponseFunction[B] = { | |
val absolutepath = if (path.startsWith("/")) path else "/" + path | |
req match { | |
case XForwardProto("https") & Host(host) => Found ~> Location("https://%s%s".format(host, absolutepath)) | |
case _ => Redirect(path) | |
} | |
object XForwardProto extends StringHeader("X-Forward-Proto") | |
} |
This file contains 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
{ | |
"collection": { | |
"version": "1.0", | |
"href": "http://example.org", | |
"items": [], | |
"queries": [ | |
{ | |
"href": "http://example.org", | |
"rel": "self", | |
"data": [ |
This file contains 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 com.example.secure | |
import unfiltered.request.{UserAgent, HttpRequest} | |
import unfiltered.response.{ResponseString, ContentType, Forbidden, ResponseFunction} | |
trait Identification { | |
type User | |
type RF = ResponseFunction[Any] | |
protected def identify(userAgent: ApiKey): Either[SecurityException, User] |
This file contains 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 doit = for { | |
foo <- lookup("foo").toInt.withName("bzz") | |
bar <- lookup("bar").withName("Brum") | |
} yield List(foo, bar) | |
val mapped = doit.apply(map).toMap // skal bli til en Map[String, Array[String]] | |
//Unfiltered QParams gjør noe nesten slik... |
OlderNewer