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
/** | |
* Buzz, Woody, Rex, and Hamm have to escape from Zurg.a They merely have | |
* to cross one last bridge before they are free. However, | |
* the bridge is fragile and can hold at most two of them at the same time. | |
* Moreover, to cross the bridge a flashlight is needed to avoid traps and broken parts. | |
* The problem is that our friends have only one flashlight with one battery that lasts for | |
* only 60 minutes (this is not a typo: sixty). The toys need different times to cross the | |
* bridge (in either direction): | |
* | |
* TOY TIME |
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
/** | |
* Ver: http://www.codewars.com/kata/common-denominators | |
*/ | |
def list_rationals = [ | |
[1, 2], [1, 3], [1, 4], //... | |
] | |
def mc = list_rationals.inject(1) { c, i -> | |
c * i[1] |
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
//Yo use la consola de firebug en firefox, se tiene que ejecutar dos veces por que | |
// sale este error 'Error: An invalid or illegal string was specified' | |
(function() { | |
var script = document.createElement("SCRIPT"); | |
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'; | |
script.type = 'text/javascript'; | |
document.getElementsByTagName("head")[0].appendChild(script); | |
var checkReady = function(callback) { | |
if (window.jQuery) { | |
callback(jQuery); |
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
using System.IO; | |
using System; | |
using System.Text; | |
using System.Net; | |
using System.Net.Sockets; | |
class Program | |
{ | |
static void Main() | |
{ |
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 you.mane | |
import javax.naming.directory.InitialDirContext | |
class Clazz { | |
static mailExchange(String email) { | |
def emailParts = email.split('@') | |
if (emailParts.size() == 2) { | |
try { | |
def domainName = emailParts[1] | |
def iniDir = new InitialDirContext(); |
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.tu.starup | |
class TestLikeSpec extends GertxSpecification { | |
def setupSpec() { //Se despliegan primero los verticles | |
deployVerticle('aplica_like.groovy') | |
} | |
def cleanup() { | |
} |
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 corg.grails.gertx | |
import org.junit.Ignore | |
import spock.lang.Shared | |
import spock.lang.Specification | |
import org.vertx.java.core.AsyncResult | |
import org.vertx.java.core.Handler | |
import org.vertx.java.core.eventbus.EventBus | |
import org.vertx.java.core.eventbus.Message | |
import org.vertx.java.core.json.JsonObject |
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.vertx.groovy.core.http.RouteMatcher | |
import groovy.sql.Sql | |
// Use this driver and put the jar in the classpath: | |
// http://mvnrepository.com/artifact/postgresql/postgresql/8.4-702.jdbc4 | |
def server = vertx.createHttpServer() | |
def routeMatcher = new RouteMatcher() | |
routeMatcher.getWithRegEx(".*") {req -> | |
def db = [ |
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
//grails-app/conf/BootStrap.groovy | |
import org.vertx.java.platform.PlatformLocator | |
class BootStrap { | |
def vertxPlatformManager | |
def init = { servletContext -> | |
vertxPlatformManager = PlatformLocator.factory.createPlatformManager() | |
URL[] classpath = [new File('./src/verticles').toURI().toURL()] | |
vertxPlatformManager.deployVerticle( |