Skip to content

Instantly share code, notes, and snippets.

View steppat's full-sized avatar

Nico Steppat steppat

View GitHub Profile
@steppat
steppat / activemq-composite
Last active August 29, 2015 14:11
exemplo composite queues com ActiveMQ
<!-- adicione abaixo do elemento broker -->
<destinationInterceptors>
<virtualDestinationInterceptor>
<virtualDestinations>
<compositeQueue name="COMP.PEDIDOS">
<forwardTo>
<filteredDestination selector="formato = 'ebook'" queue="COMP.GERADOR"/>
<queue physicalName="COMP.FINANCEIRO" />
<topic physicalName="COMP.NOTIFICACOES" />
</forwardTo>
Obs: http://tinyurl.com/oauth2-github
1) Acesse a sua conta no github e registre a aplicacao fj36-livraria, callback é:
http://localhost:8088/fj36-livraria/oauth/callback
------------------------------
2) Baixe o JAR:
http://central.maven.org/maven2/org/scribe/scribe/1.3.5/scribe-1.3.5.jar
@steppat
steppat / hornetq-stomp
Last active August 29, 2015 14:15
HornetQ com Stomp no Wildfly
1) https://github.com/leonardocordeiro/palestra-JMS-node
2) Precisa ter instalado o node.
3) No standalone-full.xml do Wildfly, no elemento <acceptors>:
<acceptor name="stomp-acceptor">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="protocol" value="STOMP"/>
<param key="port" value="61613"/>
</acceptor>
@steppat
steppat / soap-header.xslt
Last active August 29, 2015 14:16
Template para adicionar cabeçalho na mensgagem SOAP
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<!-- o template abaixo copia o XML inteiro -->
<!-- @* - seleciona todos os atributos -->
<!-- node() - seleciona todos os nodes -->
<xsl:template match="@*|node()">
<xsl:copy>
@steppat
steppat / Autorizador.java
Last active August 29, 2015 14:16
Simple Soap Handler
package br.com.caelum.estoque.ws.handler;
import java.util.Iterator;
import java.util.Set;
import javax.xml.namespace.QName;
import javax.xml.soap.Node;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
@steppat
steppat / gist:4df7e2257d7e10c50a30
Last active August 29, 2015 14:16
Simple RAML file
Obs: http://tinyurl.com/raml-file
-----
#%RAML 0.8
baseUri: http://mocksvc.mulesoft.com/mocks/a296cd19-32ae-4c10-ba8a-ffb527bd4f24
title: pagamentos
version: 1.0
mediaType: application/json
Links para ler sobre a Caelum:
https://www.caelum.com.br/10anos/
https://www.caelum.com.br/faq/
https://www.caelum.com.br/quem-somos/
https://www.caelum.com.br/apostilas/
Outras empresas (fazem parte da Caelum)
http://www.alura.com.br
http://casadocodigo.com.br
@steppat
steppat / gist:701c9084ed96a7a0b017
Created June 23, 2015 21:43
Android HttpURLConnection
try {
URL url = new URL("http://www.caelum.com.br/mobile");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-type", "application/json");
//coloca o json no corpo do POST
connection.setDoOutput(true);
PrintStream printStream = new PrintStream(connection.getOutputStream());
printStream.println(json);
public class NumeroEAgenciaValidator
implements ConstraintValidator<NumeroEAgencia, Conta> {
public void initialize(NumeroEAgencia anotacao) {
}
public boolean isValid(Conta conta, ConstraintValidatorContext ctx) {
return false;
}
}
#define TAMANHO_MAXIMO_DO_SEGREDO 4
#define REPETICOES_ESTADO_FINAL 3
#define TEMPO_LUZ 1000
#define TEMPO_PAUSA 500
#define ledVerde 2
#define ledAmarelo 3
#define ledVermelho 4
#define ledBranco 5