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
# Added the following extra packages to OSGI to enable JavaFX 2.2 (JRE 7 update 13) | |
# Extra packages appended after standard packages | |
org.osgi.framework.system.packages.extra=javafx.application;version=0.0.0, \ | |
com.sun.browser.plugin; version=0.0.0, \ | |
com.sun.deploy.uitoolkit.impl.fx; version=0.0.0, \ | |
com.sun.deploy.uitoolkit.impl.fx.ui; version=0.0.0, \ | |
com.sun.deploy.uitoolkit.impl.fx.ui.resources; version=0.0.0, \ | |
com.sun.deploy.uitoolkit.impl.fx.ui.resources.image; version=0.0.0, \ |
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
// This is a comparison between Haskell and Groovy based on some simple problems found in the following | |
// Haskell Introduction: | |
// http://learnyouahaskell.com/starting-out#ready-set-go | |
// Ex 1. If we have two lists, [2,5,10] and [8,10,11] and we want to get the products of all the possible | |
// combinations between numbers in those lists, here's what we'd do. | |
/* HASKELL */ | |
[ x*y | x <- [2,5,10], y <- [8,10,11]] |
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
package com.athaydes.automaton.internal; | |
import org.hamcrest.Description; | |
import org.hamcrest.Factory; | |
import org.hamcrest.Matcher; | |
import org.junit.internal.matchers.TypeSafeMatcher; | |
/** | |
* User: Renato | |
*/ |
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 |
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
shared void run() { | |
object mouseDownBus extends EventBus<MouseDown>() {} | |
object mouseUpBus extends EventBus<MouseUp>() {} | |
mouseDownBus.listen(void (MouseDown event) => print("1 - " + event.string)); | |
mouseDownBus.listen(void (MouseDown event) => print("2 - " + event.string)); | |
mouseUpBus.listen(void (MouseUp event) => print("3 - " + event.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
"A read-only property." | |
shared interface Property<out Prop> { | |
"Gets the value of this property." | |
shared formal Prop get; | |
"On change of the value of this property, the given function will be invoked." | |
shared formal void onChange(Anything(Prop) runOnChange); | |
} |
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
// This is a comparison between Scala and Ceylon based on this previous comparison I made between Haskell and Groovy: | |
// https://gist.github.com/renatoathaydes/5078535 | |
// Ex 1. If we have two lists, [2,5,10] and [8,10,11] and we want to get the products of all the possible | |
// combinations between numbers in those lists, here's what we'd do. | |
/* SCALA */ | |
for { x <- List(2,5,10); y <- List(8,10,11) } yield x*y |
OlderNewer