Skip to content

Instantly share code, notes, and snippets.

View greenlaw110's full-sized avatar
🏠
Working from home

Gelin Luo greenlaw110

🏠
Working from home
  • @AWS/Redshift/CP
  • Sydney Australia
View GitHub Profile
@greenlaw110
greenlaw110 / dependencies.yml
Created April 18, 2012 03:00
Playframework dependencies.yml file to use PlayRythm pre-release version
# this is not maintained, please refer to https://gist.github.com/2868365 for latest version
For example, you have a part of content to be passed to different tags as callback, and you except the tag will change the content by passing arguments, as shown below:
bc. @lookupRole(permission: "superuser").callback(List<Role> roleList) {
<ul>
@for(Role role: roleList) {
<li>role.getName()</li>
}
</ul>
}
@greenlaw110
greenlaw110 / dependencies.yml
Created May 28, 2012 01:39
Playframework dependencies.yml file to use PlayMorphia pre-release version
# this is not maintained. Please refer to https://gist.github.com/2868365 for latest morphia version
@greenlaw110
greenlaw110 / gelin-common-play-modules.yml
Last active December 5, 2023 02:36
Green's common Play modules
# Application dependencies
require:
- com.greenlaw110 -> app-base 2.1.3
- com.greenlaw110 -> play-excel 1.2.3
- com.greenlaw110 -> config 1.2.2
- com.greenlaw110 -> betterlogs 1.2j
- com.greenlaw110 -> aaa 2.1
- com.greenlaw110 -> play-rythm 1.0.1-b3
- com.greenlaw110 -> morphia 1.5.0a
@greenlaw110
greenlaw110 / look-for-pid-on-port.sh
Created June 4, 2012 20:36
Find which process is bind to a specific port
sudo netstat -anp|grep <port-number>
@greenlaw110
greenlaw110 / _aaa.yml
Created June 12, 2012 07:27
Play-aaa configuration file
# ----------------
# Privileges
# ----------------
superuser:
type: p
level: 9999
# ---------------
# Rights
# ---------------
@greenlaw110
greenlaw110 / Album.java
Created June 18, 2012 10:28
How to create a play-morphia model which contains multiple gridfs blobs
package models;
import com.google.code.morphia.annotations.Entity;
import play.modules.morphia.Model;
import java.util.List;
/**
* An album could store multiple photos persistent in the gridfs
*/
@greenlaw110
greenlaw110 / rl.g
Created June 25, 2012 20:28
a problem antlr file
grammar RL;
report
: REPORT ('(' REPORT_NAME ')')? BEGIN END
;
REPORT : 'Report';
BEGIN : 'Begin';
END : 'End';
NAME : LETTER (LETTER | DIGIT | '_')*;
@greenlaw110
greenlaw110 / index.java
Last active October 6, 2015 15:28
Define method in Rythm template
@extends(main)
@if (isMobile()) {
@layout.mobile()
} else {
@layout.desktop()
}
@greenlaw110
greenlaw110 / Error message and Stack overflow
Created July 5, 2012 01:54
Morphia Customer decode method not called
play.exceptions.JavaExecutionException: java.lang.RuntimeException: java.lang.ClassCastException: java.lang.String cannot be cast to com.mongodb.DBObject
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: java.lang.String cannot be cast to com.mongodb.DBObject
at com.google.code.morphia.mapping.Mapper.fromDb(Mapper.java:487)
at com.google.code.morphia.mapping.Mapper.fromDBObject(Mapper.java:267)
at com.google.code.morphia.query.MorphiaIterator.convertItem(MorphiaIterator.java:66)
at com.google.code.morphia.query.MorphiaIterator.processItem(MorphiaIterator.java:53)
at com.google.code.morphia.query.MorphiaIterator.next(MorphiaIterator.java:48)
at com.google.code.morphia.query.QueryImpl.get(QueryImpl.java:365)