Skip to content

Instantly share code, notes, and snippets.

package com.tiarebalbi.app.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
12-Dec-2014 14:34:00.228 SEVERE [RMI TCP Connection(4)-127.0.0.1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1587)
at sun.reflect.GeneratedMethodAccessor107.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
@tiarebalbi
tiarebalbi / introrx.md
Last active August 29, 2015 14:26 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@tiarebalbi
tiarebalbi / gist:1090119
Created July 18, 2011 17:33
Criando uma URL de Retorno no Zend
/**
* Retorna todos os parametros da URL.
* @return String URL
*/
private function _createParams()
{
$parametros = $this->_request->getParams();
$info = "";
foreach ($parametros as $item=>$valor){
package io.xxx.config;
import java.util.Collections;
import java.util.Map;
import java.util.Properties;
import org.I0Itec.zkclient.ZkClient;
import org.apache.kafka.common.serialization.StringSerializer;
import org.springframework.beans.factory.annotation.Autowired;
@tiarebalbi
tiarebalbi / Test.java
Last active December 4, 2015 18:12
Potential error on Spring Web Test
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = GerenciadorDadosApplication.class)
@WebAppConfiguration
class Test {
@Test
public void shouldSave() throws Exception {
Device device = new Device();
device.setName("RT2");
@tiarebalbi
tiarebalbi / gist:5224260
Created March 22, 2013 19:56
Newsletter generation #StampReady
<table width="100%" align="center" cellpadding="0" cellspacing="0" border="0" bgcolor="#ffffff" style="font-family: Times; font-size: medium; font-style: normal; ">
<tbody>
<tr>
<td style="border-collapse: collapse;" class="debug">
<table align="center" width="650" cellpadding="0" cellspacing="0" border="0" bgcolor="#ffffff">
<tbody>
<tr>
<td valign="middle" align="center" width="95" height="20" bgcolor="#ffffff" style="border-collapse: collapse;" class="debug">
</td>
<td valign="middle" align="center" width="460" height="20" bgcolor="#21252a" class="mailingOptions debug" style="border-collapse: collapse; color: rgb(255, 255, 255); font-family: Helvetica, Arial, Tahoma, Verdana, sans-serif; font-size: 11px; text-align: center; ">
@EnableZuulProxy
@EnableEurekaClient
@SpringBootApplication
public class GatewayApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(GatewayApplication.class).web(true).run(args);
}
}
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class CorsFilter implements Filter {
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
HttpServletRequest request = (HttpServletRequest) req;
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, PUT, GET, OPTIONS, DELETE");
// postfix sample
postfix operator ++ {}
postfix func ++ (valor: Double ) -> Double {
let novoValor = valor + 1
return novoValor
}
200++