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
if (!session) { | |
session = request.getSession(true); | |
} | |
if (!session.counter) { | |
session.counter = 1 | |
} | |
html.html { | |
head { |
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 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; |
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
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) { |
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
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" |
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
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() {} |
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
/* The Computer Language Benchmarks Game | |
http://benchmarksgame.alioth.debian.org/ | |
contributed by Renato Athaydes | |
*/ | |
import ceylon.math.decimal { | |
decimalNumber, |
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
(function() { | |
var chars = "abcdefghijklmnopqrstuvxzwyABCDEFGHIJKLMNOPQRSTUVXZWY0123456789~`!@#$%^&*()-_=+{[}]|\\;:'\"<,>.?/"; | |
/** | |
* Get a random char according to the optionsl options given. | |
* @param options can be one of: | |
* <ul> | |
* <li><b>'alpha'</b>: only returns alphabetic chars</li> | |
* <li><b>'lowercase'</b>: only returns alphabetic chars</li> |
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
// Creates an empty OSGi Blueprint project using the Maven archetype | |
// http://karaf.apache.org/manual/2.2.6/developers-guide/archetypes.html | |
def MAVEN_HOME = 'C:/Program Files/Maven/apache-maven-3.0.3/bin' | |
def cli = new CliBuilder() | |
cli.with { | |
g args: 1, 'GroupId of the artifact being created' | |
a args: 1, 'ID of the artifact being created' |
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 java.util.HashMap; | |
import java.util.Map; | |
public class RomanNumeral | |
{ | |
private static final Map<Integer, String[]> romanCharsByDecimalPlace = new HashMap<Integer, String[]>() | |
{ | |
{ | |
put( 0, new String[] |
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 java.awt.* | |
def virtualBounds = new Rectangle() | |
GraphicsEnvironment ge = GraphicsEnvironment.localGraphicsEnvironment | |
GraphicsDevice[] gs = ge.screenDevices | |
println Arrays.toString(gs) | |
gs.each { GraphicsDevice gd -> | |
GraphicsConfiguration[] gc = gd.configurations |