Skip to content

Instantly share code, notes, and snippets.

View iocopocomaioco's full-sized avatar

iocopocomaioco

View GitHub Profile
@iocopocomaioco
iocopocomaioco / gist:3828362
Created October 3, 2012 17:09
Standard GORM domain class in Grails
package 'packageName'
import 'whateverPackagesYouNeed'
// note: a GORM class can extend another - default behaviour is: they will be on same table
class User extends SecUser{
// on IDs - you must either set yorseld - or choose generation method
String userId
@iocopocomaioco
iocopocomaioco / gist:3828249
Created October 3, 2012 16:50
Basic grails commands
grails create-domain-class 'classpath&classname'
grails create-controller 'classpath&classname' // for a domain class
grails create-view 'classpath&classname' // for a domain class
grails create-all 'classpath&classname' // for a domain class
grails generate-controller 'classpath&classname' // for a domain class
grails generate-view 'classpath&classname' // for a domain class
grails generate-all 'classpath&classname' // for a domain class
grails run-app 'appname'
@iocopocomaioco
iocopocomaioco / gist:3828584
Created October 3, 2012 17:52
Using Redis with - or without - hybernate
>> Using Redis Standalone > must uninstall the Hybernate plugin
grails uninstall-plugin hibernate
With this done all domain classes in grails-app/domain will be persisted via Redis and not Hibernate.
>> If you want to persist a particular domain class with Redis then you must use the mapWith property in the domain class:
static mapWith = "redis"
@iocopocomaioco
iocopocomaioco / gist:3830624
Created October 3, 2012 23:49
Generate a UUID
//method 1
import java.util.UUID
uuid = UUID.randomUUID()
//method 2
import static java.util.UUID.randomUUID
uuid = randomUUID()
@iocopocomaioco
iocopocomaioco / gist:3832574
Created October 4, 2012 09:40
Redis Server - Cli commands
BGREWRITEAOF -
summary: Asynchronously rewrite the append-only file
BGSAVE -
summary: Asynchronously save the dataset to disk
CONFIG GET parameter
summary: Get the value of a configuration parameter
CONFIG RESETSTAT -