Skip to content

Instantly share code, notes, and snippets.

View KoloritnijClap's full-sized avatar

Dmitry KoloritnijClap

  • ISSOFT
  • Minsk
View GitHub Profile
def procBuilder = new ProcessBuilder('convert',
"-resize", "${width}x${height}", "-crop", "${x1}+${y1}+${x2}+${y2}",
'/path/to/file', '/path/to/result/file')
def proc = procBuilder.start() // run script
//Wait until done...
proc.waitFor()
burningImageService.doWith('path/to/my/file', 'path/to/output/dir').execute {
it.crop(x,y,x1,y1)
}
burningImageService.doWith(file, resultDir) execute {
outputFileName = it.scaleApproximate(x, y)
}
class AuditLogEvent implements Serializable {
private static final long serialVersionUID = 1L
Object id // id can be configured type since 1.0.4 (depending on mapping config)
static auditable = false
Date dateCreated
Date lastUpdated
auditLog {
logIds = true
}
class User {
static auditable = [ignore: ['version', 'lastUpdated', 'username', 'password']]
String username
String password
String phoneNumber
String city
}
class User {
String username
String password
String phoneNumber
String city
}
def purchaseFlow = {
init {
action {
if (params.productId) {
Product product = Product.get(params.productId)
if (product) {
flow.purchasedProduct = new PurchasedProduct(product: product, buyer: new Buyer())
} else {
return fail()
}
class PurchasedProduct {
Product product
Buyer buyer
Integer count
}
class Product {
String title
String description
Long price
String currencyCode
static mapping = {
description type: 'text'
}
}