Skip to content

Instantly share code, notes, and snippets.

View cloudSettings
View Scalike Fatal Error on jvm
# A fatal error has been detected by the Java Runtime Environment:
# SIGSEGV (0xb) at pc=0x00007fb83356488a, pid=30475, tid=0x00007fb710cee700
# JRE version: Java(TM) SE Runtime Environment (8.0_101-b13) (build 1.8.0_101-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# J 12866 C1 scalikejdbc.Binders$$$Lambda$641.apply(Ljava/lang/Object;)Ljava/lang/Object; (8 bytes) @ 0x00007fb83356488a [0x00007fb833564800+0x8a]
benoit-ponsero / gist:9258130
Created Feb 27, 2014
replace _id:BsonObjectId by id:String in play reactive mongo
View gist:9258130
import play.api.libs.json._
case class User (id:String, name:String)
object JsonFormats {
def mongoReads[T](r: Reads[T]) = {
__.json.update((__ \ 'id).json.copyFrom((__ \ '_id \ '$oid).json.pick[JsString] )) andThen r
View repeatWithIndex.scala.html
@(field:Field, min:Int=1)(f: (Field, Int) => Html)
(0 until math.max(if (field.indexes.isEmpty) 0 else field.indexes.max + 1, min)).map(i => f(field("[" + i + "]"),i))
package controllers;
import play.*;
import play.mvc.*;
import views.html.*;
import utils.JsMessages;
public class Application extends Controller {
benoit-ponsero /
Created Sep 21, 2012
Play2.1.x Ebean - @PrePersist @PostPersist @PreDestroy @PreUpdate @PostUpdate @PostLoad
package utils.db;
import com.avaje.ebean.event.BeanPersistAdapter;
import com.avaje.ebean.event.BeanPersistRequest;
import javax.annotation.PreDestroy;
import javax.persistence.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;