Skip to content

Instantly share code, notes, and snippets.

View loicdescotte's full-sized avatar

Loïc Descotte loicdescotte

View GitHub Profile
@sadache
sadache / gist:3026886
Created July 1, 2012 05:01
Bits'bout Play2 Architecture

Bits'bout Play2 Architecture

Play2 Simple HTTP API

Essential blueprint of Play2 architecture is pretty simple and it should be easy to explain in a fairly short blog post. The framework can be understood progressively at different levels; each time having better exposure to some aspects of its design.

The core of Play2 is really small, surrounded by a fair amount of useful APIs, services and structure to make Web Programming tasks easier.

Basically, Play2 is an API that abstractly have the folllowing type

@jto
jto / it.scala
Created April 21, 2012 04:08
humf
package controllers
import play.api._
import play.api.mvc._
import play.api.libs.ws._
import play.api.libs.iteratee._
import play.api.libs.concurrent._
object Application extends Controller {
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@seratch
seratch / build.sbt
Created December 1, 2011 06:07
Scala School - Testing with specs2 examples
organization := "net.seratch"
name := "sandbox"
version := "0.1"
scalaVersion := "2.9.1"
libraryDependencies ++= Seq(
"junit" % "junit" % "4.9" withSources(),
@brikis98
brikis98 / PlayAsyncIOGotchas.java
Created July 6, 2011 01:43
Play framework async I/O gotchas
public class AsyncTest extends Controller
{
public static void gotchas()
{
params.put("foo", "bar"); // Check if changes to params survive the request being suspended
renderArgs.put("foo", "bar"); // Check if changes to renderArgs survive the request being suspended
final String foo = "bar"; // Must be declared final to use in the callback
F.Promise<WS.HttpResponse> remoteCall1 = WS.url("http://www.remote-service.com/data/1").getAsync();
F.Promise<WS.HttpResponse> remoteCall2 = WS.url("http://www.remote-service.com/data/2").getAsync();
@casualjim
casualjim / ScalatraWebSocket.scala
Created December 18, 2010 21:15
WebSocket support for scalatra
package com.mojolly.websocket
import org.scalatra._
import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
import org.eclipse.jetty.websocket.{WebSocket => ServletWebSocket, WebSocketFactory}
import akka.util.Logging
import java.io.UnsupportedEncodingException
import org.eclipse.jetty.websocket.WebSocket.Outbound
import collection.mutable.{ HashSet, SynchronizedSet }