Skip to content

Instantly share code, notes, and snippets.

👾
OOO, post-surgery recovery

Diego Magalhães dgomesbr

👾
OOO, post-surgery recovery
Block or report user

Report or block dgomesbr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dgomesbr
dgomesbr / Category.cs
Created Feb 9, 2012
Mapeamento da classe Categoria no NHibernate 3.2
View Category.cs
using NHibernate.Driver;
using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;
namespace workshop_Entity
{
public class Category
{
public virtual int IdCategoria { get; set; }
public virtual string Nome { get; set; }
@dgomesbr
dgomesbr / gist:1882968
Created Feb 22, 2012
StructureMap Fooooo
View gist:1882968
For<IRepository<TipoServico>>().Use<Repository<TipoServico>>();
@dgomesbr
dgomesbr / SpringConfig.java
Created Oct 9, 2012
Spring 3.1 Configurable Class :)
View SpringConfig.java
package com.bemobi.wap.config;
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.hibernate.ejb.HibernatePersistence;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
View UserRequiredAnnotationInterceptor.java
public class UserRequiredAnnotationInterceptor extends HandlerInterceptorAdapter
{
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
{
if (handler == null)
{
return true;
}
View UserRequiredAnnotationInterceptor.java
public class UserRequiredAnnotationInterceptor extends HandlerInterceptorAdapter
{
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
{
if (handler == null)
{
return true;
}
View logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!-- if-then-else form -->
<if condition='property("profile").contains("PROD")'>
<then>
<property name="LOGGER_LEVEL" value="INFO" />
<property name="CONSOLE_LOGGER_LEVEL" value="WARN" />
</then>
<else>
<property name="LOGGER_LEVEL" value="INFO" />
View CreateSubscriptionClient.java
public SubscriptionClient createSubscriptionClient() {
//default sem timeouts
// PREFERRED_API_URL => http://subscription.bemobi.com.br/sc/
// pode ser sobrescrita pelo pela propriedade de ambiente -Dcom.bemobi.subscription.client.host ou pelo
// método #setPreferredAddress(URL);
//SubscriptionJAXRSClient client = new SubscriptionJAXRSClient();
int TIMEOUT_IN_MILIS = 35 * 1000;
int MAX_CONNECTION_IN_POOL = 100;
return new SubscriptionJAXRSClient(TIMEOUT_IN_MILIS, TIMEOUT_IN_MILIS, MAX_CONNECTION_IN_POOL);
}
@dgomesbr
dgomesbr / master.vm
Created Sep 2, 2016 — forked from rpgreen/master.vm
API Gateway "Send Everything" Mapping Template
View master.vm
## API Gateway "Send Everything" Mapping Template - Ryan Green - ryang@ryang.ca
## See http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
#set($allParams = $input.params())
{
"body-json" : "$input.json('$')",
"params" : {
#foreach($type in $allParams.keySet())
#set($params = $allParams.get($type))
"$type" : {
#foreach($paramName in $params.keySet())
@dgomesbr
dgomesbr / create-silence.sh
Created Dec 8, 2016
Create silence sound and convert to mp3
View create-silence.sh
!#bin/bash
sox -n -r 44100 -c 2 silence.wav trim 0.0 2
lame -b 32 --resample 8 -a silence.wav silence.mp3
@dgomesbr
dgomesbr / RedisLoaderApplication.java
Last active Jul 6, 2018
Redis Pipeline: spring-data-redis vs simple jedis
View RedisLoaderApplication.java
import com.lambdaworks.redis.RedisAsyncConnection;
import com.lambdaworks.redis.RedisClient;
import com.lambdaworks.redis.SetArgs;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
You can’t perform that action at this time.