This script is created as an example to show how easy it is to use gstorm to crunch and consume data from rest apis.
Either download the script and run:
groovy ghstarred.groovy <your_github_id>
Or hotload it:
This script is created as an example to show how easy it is to use gstorm to crunch and consume data from rest apis.
Either download the script and run:
groovy ghstarred.groovy <your_github_id>
Or hotload it:
$ gradle stats | |
:stats | |
+----------------------+-------+-------+ | |
| Name | Files | LOC | | |
+----------------------+-------+-------+ | |
| Groovy Sources | 4 | 28 | | |
| Java Sources | 1 | 2 | | |
| Groovy Test Sources | 1 | 16 | | |
| Models | 1 | 8 | |
public abstract class DirWatcher extends TimerTask { | |
def path | |
def dir = [:] | |
// Exclude temp files created by vim, emacs, etc... | |
FileFilter fileFilter = {file -> !(file.name =~ /\.swp$|\~$|^\./)} as FileFilter | |
public DirWatcher(String path) { | |
this.path = path; | |
def files = new File(path).listFiles(fileFilter); | |
@Grab("com.h2database:h2:1.3.173") | |
import grails.persistence.* | |
@Entity | |
@Resource(uri='/books') | |
class Book { | |
String title | |
} |
$ grails create-app grails-blog | |
$ cd grails-blog | |
$ grails install-plugin simple-blog | |
$ cat >> grails-app/conf/Config.groovy | |
> grails.blog.author.evaluator = { request.remoteAddr } | |
> ^D | |
$ mkdir -p grails-app/domain/demo/blog/ | |
$ cat > grails-app/domain/demo/blog/Commenter.groovy | |
> package demo.blog | |
> |
class BooleanCategory { | |
public static Boolean then(Boolean self, Closure c) { | |
if(self) c() | |
return self | |
} | |
public static Boolean otherwise(Boolean self, Closure c) { | |
if(!self) c() | |
return self |
task args | |
args.map = [:] | |
tasks.addRule("Pattern: <property>=<value>: Passes arguments to the scripts") { String taskName -> | |
def match = taskName =~ /(.*?)=(.*?$)/ | |
if(match){ | |
args.map[match[0][1]] = match[0][2] | |
task(taskName) << { | |
println "Used to pass value ${match[0][2]} to args.map.${match[0][1]}" | |
} |
enum OS { | |
DOS('PC DOS 2000 License'), WIN('Genuine Windows 7 Professional 32'); | |
private final String text | |
private OS(text) { this.text = text } | |
public static parseText(text) { OS.values().find { it.text == text } } | |
} |
package groovyx.gaelyk | |
import groovyx.gaelyk.logging.LoggerAccessor; | |
import spock.lang.Specification | |
import spock.lang.Unroll; | |
import com.google.appengine.api.LifecycleManager; | |
import com.google.appengine.api.NamespaceManager; | |
import com.google.appengine.api.backends.BackendService; | |
import com.google.appengine.api.blobstore.BlobstoreService; |
require "sinatra" | |
require "slim" | |
require "coffee-script" | |
require "sass" | |
require "eventmachine" | |
get "/" do | |
slim :html | |
end |