Skip to content

Instantly share code, notes, and snippets.

View rodrigoSaladoAnaya's full-sized avatar

Rodrigo Salado Anaya rodrigoSaladoAnaya

View GitHub Profile
@rodrigoSaladoAnaya
rodrigoSaladoAnaya / dojo_lcd.py
Created April 16, 2012 15:46 — forked from yngwie74/dojo_lcd.py
LCD numbers kata and tests (python)
#!/usr/bin/python
# -*- coding: utf-8 -*-
_NONE = ' '
_LEFT = '| '
_MIDL = ' - '
_RGHT = ' |'
_BOTH = '| |'
_SEGMENTS_BY_DIGIT = {
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.ws.Holder;
import java.math.BigDecimal;
public class HelloWorldClient {
public static void main(String[] argv) {
Wschan service = new Wschan_Service().getWschanPort();
System.out.println(service);
System.out.println("Saldo:_________");
@rodrigoSaladoAnaya
rodrigoSaladoAnaya / EjemploEnvioEcoVertxTest.groovy
Last active December 17, 2015 21:09
Ejemplo de como se manda una trama tipo 'eco' a test (Vertx)
import static org.vertx.groovy.core.streams.Pump.createPump
import org.vertx.groovy.core.buffer.Buffer
def client = vertx.createNetClient()
client.connect(1234, "201.000.000.000") { socket ->
println "Conectado!"
def key = "08000220000100000000051300240412655910MEXWS1TEST"
byte[] bytesKey = new byte[key.bytes.length + 3]
for(int i = 2; i < key.bytes.length + 2; i++){
@rodrigoSaladoAnaya
rodrigoSaladoAnaya / BootStrap VertxConf
Created July 9, 2013 22:38
Ref https://gist.github.com/pledbrook/2652835 Grails version: 2.2.2 Groovy Version: 2.1.5 JVM: 1.7.0_09 Vendor: Oracle Corporation OS: Mac OS X java version "1.7.0_09"
import org.vertx.java.core.Handler
import org.vertx.java.core.Vertx
import org.vertx.java.core.VertxFactory
import org.vertx.java.core.http.HttpServer
import org.vertx.java.core.json.JsonObject
class BootStrap {
def init = { servletContext ->
Vertx vertx = VertxFactory.newVertx()
@rodrigoSaladoAnaya
rodrigoSaladoAnaya / BootStrap.groovy
Last active December 19, 2015 14:58
How to integrating Vert-x in Grails using a PlatformManager. (Test)
//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(
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 = [
@rodrigoSaladoAnaya
rodrigoSaladoAnaya / GertxSpecification.groovy
Last active August 29, 2015 14:04
Como hacer una prueba de integración a un verticle Vert.x
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
@rodrigoSaladoAnaya
rodrigoSaladoAnaya / TestLikeSpec.groovy
Created July 18, 2014 01:17
Un ejemplo de como usar GertxSpecification
package com.tu.starup
class TestLikeSpec extends GertxSpecification {
def setupSpec() { //Se despliegan primero los verticles
deployVerticle('aplica_like.groovy')
}
def cleanup() {
}
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();
/**
* vertx version:
* 2.1.2 (built 2014-07-24 07:45:28)
* test:
* vertx run shared_set_error.groovy
**/
import org.vertx.java.core.shareddata.impl.SharedSet
SharedSet<String> sharedSet = vertx.sharedData.getSet(