Skip to content

Instantly share code, notes, and snippets.

View oxsean's full-sized avatar

Sean Yang oxsean

  • Cloud Software Group
  • Nanjing, China
  • 22:33 (UTC +08:00)
  • LinkedIn in/oxsean
View GitHub Profile
@oxsean
oxsean / gist:9967319
Created April 4, 2014 03:09
node-introspect
var argumentsRegExp = /\(([\s\S]*?)\)/;
var replaceRegExp = /[ ,\n\r\t]+/;
module.exports = function (fn) {
var fnArguments = argumentsRegExp.exec(fn)[1].trim();
if (0 === fnArguments.length) return [];
return fnArguments.split(replaceRegExp);
};
//from https://github.com/kilianc/node-introspect
@oxsean
oxsean / hibernate cache sync
Created July 4, 2013 16:45
hibernate cache sync
public boolean onPreInsert(PreInsertEvent event) {
if (false) {
return false;
}
final EntityPersister persister = event.getPersister();
Type[] propertyTypes = persister.getPropertyTypes();
for (int i = 0, len = propertyTypes.length; i < len; i++) {
Type type = propertyTypes[i];
if (type instanceof ManyToOneType) {
Object value = persister.getPropertyValue(event.getEntity(), i);