⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.robfletcher.grails.validation | |
import org.codehaus.groovy.grails.validation.AbstractConstraint | |
import org.springframework.validation.Errors | |
class AcyclicConstraint extends AbstractConstraint { | |
static final String DEFAULT_MESSAGE_CODE = "default.acyclic.violation.message" | |
static final String NAME = "acyclic" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.JsonOutput | |
// File is just a list of words, one per line. | |
def counts = new File("types.txt").readLines().inject([:]) {Map obj, String val -> | |
// If we hit an empty line, do nothing and just return the map as-is | |
if (val) { | |
if (!obj[val]) { | |
// The key didn't exist, so put it into the map | |
obj[val] = 1 | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyDomain { | |
... | |
static constraints = { | |
items(validator: requiresAtleastOne) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package edu.wisc.radiology.performanceevaluations | |
import grails.converters.JSON | |
import grails.converters.XML | |
import grails.plugins.springsecurity.Secured | |
import grails.validation.Validateable | |
@Secured("hasRole('ROLE_USER')") | |
class RequestPeerEvaluationController { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g. | |
// Allows connecting to MySQL DBs | |
runtime 'mysql:mysql-connector-java:5.1.22' | |
// For JodaTime plugin | |
compile "org.jadira.usertype:usertype.jodatime:1.9.1" | |
// So that spock can work with Grails 2.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var empty_list = function(selector) { | |
return selector(undefined, undefined, true); | |
}; | |
var prepend = function(el, list) { | |
return function(selector) { | |
return selector(el, list, false); | |
}; | |
}; | |
var head = function(list) { |
TODO: Fill in the problem statement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// isPalindrome - ignore cases, spaces and punctuation | |
// Empty string is false | |
// O(1) space, cant modify original string | |
[1,2,3,4,5,6].each { | |
println "Running isPalindrome${it}" | |
assert !"isPalindrome${it}"("") // False | |
assert !"isPalindrome${it}"(" !,! ") // False | |
assert "isPalindrome${it}"("M") // True | |
assert "isPalindrome${it}"("M.") // True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// isPalindrome - ignore cases, spaces and punctuation | |
// Empty string is false | |
// O(1) space, cant modify original string | |
[1,2,3,4,5,6].each { | |
println "Running isPalindrome${it}" | |
assert !"isPalindrome${it}"("") // False | |
assert !"isPalindrome${it}"(" !,! ") // False | |
assert "isPalindrome${it}"("M") // True | |
assert "isPalindrome${it}"("MM..M") // True |
OlderNewer