Skip to content

Instantly share code, notes, and snippets.

View erikfried's full-sized avatar

Erik Fried erikfried

View GitHub Profile
@erikfried
erikfried / Controller.scala
Created June 3, 2013 21:06
Automagic content negotiation with playframework (version >= 2.1). If called with Accept: application/json => { "firstName": "Erik", "surName": "Fried", "age": 34 } Accept: text/xml => <person> <firstName>Erik</firstName> <surName>Fried</surName> <age>34</age> </person>
package controllers
import play.api.mvc._
import play.api.libs.json.{Writes, Json}
import test.PersonRepository
import scala.xml.Elem
object PersonResource extends Controller with ContentNegotiation {
@erikfried
erikfried / README.md
Last active December 22, 2015 10:59
Run tests locally with sbt in maven project.

What does sbt have that maven does not?

  1. Continuous compilation, that is files are compiled and tested upon file change. Just run any target with ~, eg sbt ~test
  2. Sheer speed. The full test execution takes about half the time compared to maven.
  3. test-quick - An sbt target that only runs tests that either a) failed in the previous run b) have not run before or c) Have recompiled dependencies.

How?

@erikfried
erikfried / user.json
Last active December 30, 2015 20:39
Spid api object
{
"name": "SPPContainer",
"version": "0.2",
"api": 2,
"object": "User",
"type": "element",
"code": 200,
"request": {
"reset": 3571,
"limit": 0,
@erikfried
erikfried / pulse2_section_page_0.2.json
Last active August 29, 2015 14:23
Example of pulse2 tagging of section page
[
{
"@context": [
"http://www.w3.org/ns/activitystreams",
{
"spt": "http://schibsted.com",
"spt:sdkType": "JS",
"spt:sdkVersion": "0.3.0"
}
],
@erikfried
erikfried / pulse2_premium_page_tracking.json
Last active August 29, 2015 14:23
Example of pulse2 tracking for a plus article page
[
{
"@context": [
"http://www.w3.org/ns/activitystreams",
{
"spt": "http://schibsted.com",
"spt:sdkType": "JS",
"spt:sdkVersion": "0.3.0"
}
],
@erikfried
erikfried / keybase.md
Created June 16, 2017 10:40
keybase.md

Keybase proof

I hereby claim:

  • I am erikfried on github.
  • I am scherik (https://keybase.io/scherik) on keybase.
  • I have a public key ASA5cBD0kmd-tw_Bxh4rJdq5lQpgcQa7EzoSJlTk5-t1fQo

To claim this, I am signing this object: