Skip to content

Instantly share code, notes, and snippets.

View renatoathaydes's full-sized avatar

Renato Athaydes renatoathaydes

View GitHub Profile
@renatoathaydes
renatoathaydes / RomanNumeral.java
Created April 17, 2013 07:22
Converter of Arabic numbers to Roman numbers
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[]
@renatoathaydes
renatoathaydes / HaskellVSGroovy.groovy
Last active June 13, 2019 03:59
Haskell VS Groovy
// 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]]
@renatoathaydes
renatoathaydes / JavaFX in OSGi
Last active March 9, 2020 09:48
Packages needed by JavaFX 2.2 to work in OSGi
# 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, \
@renatoathaydes
renatoathaydes / createOsgiBluePrintProject.groovy
Created February 3, 2013 19:09
Creates a simple Osgi Blueprint Project using a Maven Archetype.
// 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'
@renatoathaydes
renatoathaydes / util.js
Created November 3, 2012 20:31
Util JavaScript functions
(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>