This file contains hidden or 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
| Object.metaClass.not_in = {obj -> | |
| !(delegate in obj) | |
| } | |
| boolean ifnot(boolean val, Closure closure) { | |
| if (!val) { | |
| closure.call() | |
| } | |
| } |
This file contains hidden or 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
| task(console, dependsOn: 'classes', type: JavaExec) { | |
| main = 'groovy.ui.Console' | |
| classpath = sourceSets.main.runtimeClasspath | |
| } |
This file contains hidden or 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
| @Grapes([ | |
| @Grab(group='org.apache.commons', module='commons-vfs2', version='2.0'), | |
| @Grab(group='commons-httpclient', module='commons-httpclient', version='3.1') | |
| ]) | |
| import org.apache.commons.vfs2.VFS | |
| import org.apache.commons.vfs2.FileUtil | |
| import org.apache.commons.vfs2.FileListener | |
| import org.apache.commons.vfs2.FileObject | |
| import org.apache.commons.vfs2.FileSystemManager |
This file contains hidden or 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
| @GrabResolver(name='grails-core', root='http://repo.grails.org/grails/core') | |
| @Grab(group='org.grails', module='grails-datastore-gorm-mongo', version='1.0.0.BUILD-SNAPSHOT') | |
| @Grab(group='org.slf4j', module='slf4j-simple', version='1.6.1') | |
| import grails.persistence.* | |
| import org.grails.datastore.gorm.mongo.config.* | |
| MongoDatastoreConfigurer.configure("myDatabase", Book) | |
| Book.withSession { |
This file contains hidden or 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 FnCheck { | |
| static class Evaluation { | |
| Closure condition | |
| Closure execution | |
| } | |
| def conditions = [] | |
| def parameters = [:] |
This file contains hidden or 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 groovyx.gpars.actor.Actors | |
| import groovyx.gpars.actor.DefaultActor | |
| import groovyx.gpars.actor.DynamicDispatchActor | |
| class SupervisedException extends Exception { | |
| SupervisedException(String message) { | |
| super(message) | |
| } | |
| } |
This file contains hidden or 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.transform.Immutable | |
| // PROTOCOLO | |
| interface Functor { | |
| Functor fmap(Closure fn) | |
| } | |
| interface Applicative { | |
| Applicative fapply(Applicative afn) |
This file contains hidden or 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
| interface Fn<I,O> { | |
| O execute(I i) | |
| } | |
| // applies a function to a value | |
| // TODO while I think functions could be parametrized | |
| // functors should not. Functions are a special case | |
| // of functors | |
| interface Functor<I,O> { | |
| I getValue() |
This file contains hidden or 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
| interface HasUser { | |
| User getUser() | |
| } | |
| interface HasBank { | |
| Bank getBank() | |
| } | |
| interface Validator<T> { | |
| Boolean validate(T validateable) |
OlderNewer