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
#!/bin/bash | |
# | |
# Use this script with sudo to install multiple golang | |
# installations. | |
if [[ $(id -u) -ne 0 ]] ; then echo "This script should be run using | |
sudo or as the root user" ; exit 1 ; | |
fi | |
# Ensure the user wants to rm the contents of /opt/golang! |
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
// Start play, go into the console and copy & paste these lines | |
import scala.concurrent._ | |
import scala.concurrent.duration._ | |
import scala.language.postfixOps | |
import play.api.libs.iteratee._ | |
import play.api.libs.concurrent.Execution.Implicits._ | |
val enumerateUsers: Enumerator[String] = { | |
Enumerator("Guillaume", "Sadek", "Peter", "Erwan") | |
} |
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
// Works in the console from a Play 2.2 project | |
import org.apache.commons.codec.binary.Base64 | |
val encoded: Array[Byte] = Base64.encodeBase64("text to be encoded".getBytes) | |
val decoded: Array[Byte] = Base64.decodeBase64(encoded) | |
println(new String(decoded)) |
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
// Code snippets to illustrate working with the | |
// Enumeratee api from Play Framework | |
// http://www.playframework.com/documentation/2.2.x/Iteratees | |
// You should create a play app and then launch the scala console from it. | |
// Then you can paste these snippets in to experiment with iteratees | |
// in the scala REPL. | |
import play.api.libs.iteratee._ | |
import play.api.libs.concurrent.Execution.Implicits._ |
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
import akka.actor._ | |
// need an actor system, make it implicit to it's used by all our repl based actors | |
implicit val system = ActorSystem("replActorSystem") | |
// this gives us an easy way to define simple actors | |
import ActorDSL._ | |
// make an actor that can be used to receive responses... just a good practice | |
implicit val sender = actor(new Act { become { case msg => println(s"Console sender recvd: $msg") } } ) | |
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
// Code snippets to illustrate working with | |
// Iteratee / Enumerator / Enumeratee api from Play Framework | |
// http://www.playframework.com/documentation/2.2.x/Iteratees | |
// You should create a play app and then launch the scala console from it. | |
// Then you can paste these snippets in to experiment with iteratees | |
// in the scala REPL. | |
import play.api.libs.iteratee._ | |
import play.api.libs.concurrent.Execution.Implicits._ |
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
import akka.actor._ | |
// need an actor system, make it implicit to it's used by all our repl based actors | |
implicit val system = ActorSystem("replActorSystem") | |
// this gives us an easy way to define simple actors | |
import ActorDSL._ | |
// here's a simple example of creating an actor | |
// Also, this will give us a simple actor that is used to print the | |
// results sent back to us from the other actors. |
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
#include "UofARecs.hpp" | |
#include "avro/Encoder.hh" | |
#include "avro/Decoder.hh" | |
int | |
main() | |
{ | |
std::auto_ptr<avro::OutputStream> out = avro::memoryOutputStream(); |
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 controllers | |
import play.api._ | |
import play.api.mvc._ | |
import play.api.libs.json._ | |
// you need this import to have combinators | |
import play.api.libs.functional.syntax._ | |
// Add this to your conf/routes | |
// POST /JsSayHello controllers.JsonServices.sayHello |
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
# Add this to your conf/routes file | |
# Universal Proxy | |
GET /proxyGet/*urlToProxy controllers.Application.proxyGet(urlToProxy) | |
# Add this to a Controller class, e.g. Application | |
import play.api.libs.ws.WS | |
import play.api.libs.concurrent.Execution.Implicits._ |
NewerOlder