Skip to content

Instantly share code, notes, and snippets.

@mlist
mlist / g.select.from.map.jsp
Created March 26, 2012 10:12
grails g:select from a map
<g:select name="selectedCellLineData" optionKey="key" optionValue="value" from="${someMap}" multiple="true"/>
@mlist
mlist / create changelog
Created June 22, 2012 15:48
create a changelog for an existing database with the grails database migration plugin
grails -Dgrails.env=migrate dbm-gorm-diff --add changelog-0.2.groovy
@mlist
mlist / addNotNullConstraint.groovy
Created June 22, 2012 15:53
changeSet for adding a not null constraint with a default value for existing nulls
changeSet(author: "mlist (generated)", id: "1340373645634-47") {
addNotNullConstraint(columnDataType: "bigint", columnName: "createdBy", schemaName: "dbo", tableName: "slide_layout", defaultNullValue: 1)
}
@mlist
mlist / dbm-update.sh
Created June 22, 2012 15:59
apply changelog to database
grails -Dgrails.env=migrate dbm-update
@mlist
mlist / specify-changelog-Config.groov
Created June 22, 2012 16:03
specify your changelog file in Config.groovy before running dbm-update
//select migration file
grails.plugin.databasemigration.changelogFileName = 'changelog-0.3.groovy'
@mlist
mlist / dbchangelog.sql
Created June 22, 2012 16:08
shows you which changes have been applied
select * from databasechangelog order by orderexecuted
@mlist
mlist / changeSet_defaultNullValue_date.groovy
Created June 22, 2012 16:28
Setting a default null value in a changeSet with a datetime2 field
changeSet(author: "mlist (generated)", id: "1340373645634-47") {
addNotNullConstraint(columnDataType: "datetime2", columnName: "date_created", schemaName: "dbo", tableName: "slide_layout",
defaultNullValue: "2012-06-22 00:00:00.0000000")
}
@mlist
mlist / add license header.groovy
Created May 8, 2013 08:06
Add license header to each groovy file in a folder using a groovy script
import static groovy.io.FileType.*
import static groovy.io.FileVisitResult.*
def headerFile = new File("/home/markus/Projects/olf_gpl3_license.txt")
def headerLines = headerFile.readLines()
def sourcebase = new File("/home/markus/Projects/OpenLabFramework")
sourcebase.traverse(
type : FILES,
nameFilter : ~/.*\.groovy/,
preDir : { if (it.name == '.svn' || it.name == '.idea' || it.name == '.git') return SKIP_SUBTREE }
) { f ->
@mlist
mlist / update_gitignore
Created October 28, 2013 14:16
Resync with new .gitignore in git repository
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
@mlist
mlist / RmiR_working_example.r
Created November 5, 2013 10:21
Minimal working example to reproduce the RmiR package loading problem in shiny-server-pro 0.4 beta
source("http://bioconductor.org/biocLite.R")
biocLite("RmiR")