Skip to content

Instantly share code, notes, and snippets.

View guillaumebort's full-sized avatar

Guillaume Bort guillaumebort

View GitHub Profile
{"id":26,"label":"document","children":[{"id":14,"label":"heading1","children":[{"id":15,"content":"SURFACEPAD “THE ONLY CASE I WOULD CONSIDER USING WITH AN IPHONE”","parents":"14-26","tags":[]}],"parents":"26","tags":[]},{"id":16,"label":"paragraph","children":[{"id":17,"content":"This SurfacePad review is just so good we had to share it with you. If you’ve been following our SurfacePad for iPhone news, you already know it’s a product for, well, people who would rather their iPhone be au naturale…but they want to protect the screen and back from keys and hard surfaces. Gizmodo editor Jesus Dias gets it. In his doesn’t-mince-words-words:","parents":"16-26","tags":[]}],"parents":"26","tags":[]},{"id":18,"label":"paragraph","children":[{"id":19,"content":"“No, you don’t need a damn case for your iPhone 5—but if you have butterfingers and you must use a case, this seems to me like the only acceptable one. The SurfacePad is not only simple and elegant—complementing the iPhone’s design rather than turning it into
package controllers
import play.api._
import play.api.mvc._
import play.api.templates._
import reactivemongo.api._
import play.modules.reactivemongo._
import play.modules.reactivemongo.json.collection.JSONCollection
request.headers.get(CONTENT_TYPE) match {
case Some(ct) if ct.trim.startsWith("multipart/form-data") =>
filterLogger.trace("[CSRF] request is multipart/form-data")
checkMultipart(request, token, next)
case Some(ct) if ct.trim.startsWith("application/x-www-form-urlencoded") =>
filterLogger.trace("[CSRF] request is application/x-www-form-urlencoded")
checkFormUrlEncodedBody(request, token, next)
case Some(ct) if ct.trim.startsWith("text/plain") =>
filterLogger.trace("[CSRF] request is text/playn")
checkTextBody(request, token, next)
package controllers;
import play.*;
import play.mvc.*;
import views.html.*;
public class Application extends Controller {
public static Result index(String name) {
@guillaumebort
guillaumebort / gist:8314512
Last active July 25, 2016 02:19
Force HTTPS decorator for Play framework
def forceHttps(handler: Handler, request: RequestHeader): Handler = {
(isHTTPSRequired, isRequestSecure(request), request.method, request.uri) match {
// HTTPS is supported but not required for the API
case (_, _, _, uri) if uri.startsWith("/api") => handler
// HTTPS is required here, redirect GET requests
case (true, false, "GET", uri) => Action(Results.Redirect(s"https://${request.domain}${request.uri}"))
// HTTPS is required but we can't redirect
@guillaumebort
guillaumebort / gist:9660586
Last active August 29, 2015 13:57
Sample prismic.io Structured Text value
body: {
type: "StructuredText"
value: [
- { … }
- { … }
- { … }
- { … }
- { … }
- { … }
- { … }
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Your prismic.io singlepage project</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="prismic-repository" content="https://lesbonneschoses.prismic.io/api">