Skip to content

Instantly share code, notes, and snippets.

View gre's full-sized avatar
3 cups required

@greweb gre

3 cups required
View GitHub Profile
@gre
gre / code.scala
Created December 12, 2011 09:34 — forked from sadache/code.scala
Play20 Promise sequence function
// What is a Promise sequence function ?
// A function which transform a List[Promise[A]] into a Promise[List[A]]
// Usage:
// val list: List[Promise[Int]] = ...
// val sequenced: Promise[List[Int]] = list.sequence() // got it :)
package utils
import play.api.libs.concurrent._
@gre
gre / poc.scala
Last active December 9, 2015 20:58 — forked from anonymous/poc.scala
[Feature Request] Play Framework Iteratees + UNIX Pipe
// https://github.com/gre/playCLI
@gre
gre / LICENSE.txt
Last active December 14, 2015 09:19 — forked from zxamplez/CODE
retrieve, process and re-encode a video with #PlayCLI and #Iteratees .
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@gre
gre / LICENSE.txt
Last active December 14, 2015 09:19 — forked from zxamplez/CODE
Download an #OGG stream, add an echo effect, stream it again with #PlayCLI and #Iteratees .
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@gre
gre / LICENSE.txt
Last active December 14, 2015 09:19 — forked from zxamplez/CODE
Provides a #JSON implicit converter for java.awt.Color with #playJson.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@gre
gre / LICENSE.txt
Last active December 14, 2015 09:28 — forked from zxamplez/CODE
Convert a JPG to PNG with indexed colors (color quantization) - #PlayCLI and #imagemagick
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@gre
gre / README.md
Last active December 19, 2015 10:49 — forked from zxamplez/CODE
#test gist multi-files

Play By Example

A collection of Play Framework code snippets used by PlayByExample (snippets aggregator) - inspired by 140byt.es

How to use

  1. Fork this gist to create a new snippet.
  2. Modify your gist according to Rules.
@gre
gre / CODE.scala
Last active December 20, 2015 01:59 — forked from playxamplez-admin/CODE
Convert JPG to PNG with indexed colors (color quantization) using #PlayCLI and #imagemagick
val file = Play.getFile("example.jpg")
def colorsQuantization = Action {
Ok.stream(Enumerator.fromFile(file) &> convertColors(14))
.withHeaders(CONTENT_TYPE -> "image/png")
}
@gre
gre / CODE.scala
Last active December 20, 2015 01:59 — forked from playxamplez-admin/CODE
Provides a #JSON implicit converter for java.awt.Color with #playJson.
implicit val ColorWrites = Writes[java.awt.Color] { c =>
JsString("#%02x%02x%02x" format (c.getRed, c.getGreen, c.getBlue))
}
@gre
gre / CODE.scala
Last active December 20, 2015 01:59 — forked from playxamplez-admin/CODE
Download an #OGG stream, add an echo effect, stream it again with #PlayCLI and #Iteratees
val audioStream: Enumerator[Array[Byte]] = getStream("http://radio.hbr1.com:19800/ambient.ogg")
val addEchoToOgg =CLI.pipe("sox -t ogg - -t ogg - echo 0.5 0.7 60 1")
def webRadioWithEcho = Action {
Ok.stream(audioStream &> addEchoToOgg)
.withHeaders(CONTENT_TYPE -> "audio/ogg")
}