I hereby claim:
- I am renatoathaydes on github.
- I am renatoathaydes (https://keybase.io/renatoathaydes) on keybase.
- I have a public key ASD6izZl-Pe5lHzlFdjcZS6HjOG_pPWAkvLfZvAEo2Q9xwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
/* | |
* This is a runnable groovy script. | |
* Run with "groovy client.groovy". | |
* | |
* Don't forget to start the server.groovy script first (shown in this gist). | |
*/ | |
import groovy.transform.CompileStatic | |
import groovy.transform.Immutable | |
import groovy.transform.ToString |
import groovy.io.FileType | |
import groovy.util.slurpersupport.GPathResult | |
import groovy.xml.XmlUtil | |
def intellijFileVisitor = { File intellijFile -> | |
def groovyDir = new File(intellijFile.parentFile, 'src/test/groovy') | |
if (groovyDir.isDirectory() && groovyDir.list()?.size() > 0) { | |
def module = new XmlSlurper().parse(intellijFile) | |
GPathResult sources = module.component.content.sourceFolder | |
def groovySources = sources.any { it.@url == 'file://$MODULE_DIR$/src/test/groovy' } |
/* The Computer Language Benchmarks Game | |
http://benchmarksgame.alioth.debian.org/ | |
contributed by Renato Athaydes | |
*/ | |
import ceylon.math.decimal { | |
decimalNumber, |
abstract class Thing() { | |
string => className(this).split('.'.equals).last?.string else ""; | |
} | |
abstract class World(shared Thing+ contents) {} | |
abstract class Ocean() extends Thing() {} | |
abstract class Land() of Continent|Island extends Thing() {} |
totalValue = 4500000 | |
pantbrev = 1534900 | |
/////////////////////////////////// | |
fromApt = 699500 | |
lagFart = 0.015 * totalValue | |
toPay = 0.15 * totalValue + 0.02 * (Math.max(0, totalValue - pantbrev)) + lagFart | |
println "Total to pay $toPay" |
String askUser(String question) { | |
process.write(question); | |
return process.readLine(); | |
} | |
Float? askUserForNumber(String question) => parseFloat(askUser(question)); | |
void printResult(Float(Float, Float=, Float=) operation, Float x, Float? y, Float? z) { | |
Float result; | |
if (exists y) { |
import org.jclouds.ContextBuilder; | |
import org.jclouds.compute.ComputeService; | |
import org.jclouds.compute.ComputeServiceContext; | |
import org.jclouds.compute.RunNodesException; | |
import org.jclouds.compute.domain.ComputeMetadata; | |
import org.jclouds.compute.domain.NodeMetadata; | |
import org.jclouds.compute.domain.OsFamily; | |
import org.jclouds.compute.domain.Template; | |
import org.jclouds.ec2.domain.InstanceType; |
if (!session) { | |
session = request.getSession(true); | |
} | |
if (!session.counter) { | |
session.counter = 1 | |
} | |
html.html { | |
head { |
#!/usr/bin/env groovy | |
import org.eclipse.jetty.server.Server | |
import org.eclipse.jetty.servlet.* | |
import groovy.servlet.* | |
@Grab(group='org.eclipse.jetty.aggregate', module='jetty-all', version='7.6.15.v20140411') | |
def startJetty() { | |
def server = new Server(8080) |