Skip to content

Instantly share code, notes, and snippets.

@benoit-ponsero
benoit-ponsero / git-story
Last active January 10, 2023 14:45
git log your repository and filter commit by dates and author. works with multiple repo. (useful for time tracking commits driven)
#!/bin/bash
start=$(date -v -30d +%Y-%m-%d)
stop=$(date +%Y-%m-%d)
author=$(git config user.name)
maxdepth=2
while [ $# -gt 0 ]; do
case "$1" in
--start=*)
{"version":1,"resource":"file:///Users/bpo/Library/Caches/Transmit/9F824764-DB47-467E-8790-D89E79D86B14/access870167040.webspace-data.io/Web/themes/platinum/modules/ps_emailsubscription/views/templates/hook/ps_emailsubscription.tpl","entries":[{"id":"JuDy.tpl","timestamp":1649879851156},{"id":"PcrU.tpl","timestamp":1649879924951},{"id":"3n0O.tpl","timestamp":1649879938033},{"id":"7Nri.tpl","timestamp":1649880713507}]}
#
# 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
benoit-ponsero / gist:9258130
Created February 27, 2014 19:55
replace _id:BsonObjectId by id:String in play reactive mongo
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
}
@(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))
}
@benoit-ponsero
benoit-ponsero / Application.java
Created October 16, 2012 15:00
Play2 JsMessages
package controllers;
import play.*;
import play.mvc.*;
import views.html.*;
import utils.JsMessages;
public class Application extends Controller {
@benoit-ponsero
benoit-ponsero / EbeanPersistController.java
Created September 21, 2012 12:13
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;