Skip to content

Instantly share code, notes, and snippets.

View garcia-jj's full-sized avatar

Otávio Garcia garcia-jj

  • Atlassian
View GitHub Profile
<target name="minify">
<property name="static.library.dir" value="${build.dir}/${project.web}/static/library" />
<property name="yuicompressor.jar" value="/opt/yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar" />
<fileset dir="${project.web}/web/static/library" includes="*.js" excludes="*.min.js" id="alljs" />
<fileset dir="${project.web}/web/static/library" includes="*.css" excludes="*.min.css" id="allcss" />
<delete file="${build.dir}/${project.web}/static/library/all.css" />
<concat destfile="${build.dir}/${project.web}/static/library/all.css" fixlastline="true">
<fileset refid="allcss" />
@garcia-jj
garcia-jj / ProxifierPerformance.java
Created February 10, 2011 01:32
cglib vs javassist performance tests
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.concurrent.Callable;
import javassist.util.proxy.MethodHandler;
import javassist.util.proxy.ProxyFactory;
import javassist.util.proxy.ProxyObject;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import static com.google.common.base.Objects.firstNonNull;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
package security;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.junit.Before;
@garcia-jj
garcia-jj / migration.sh
Created February 27, 2013 11:01
Migrando plugin de JPA a partir do projeto vraptor-core para seu próprio repositório.
git clone vraptor vraptor-jpa && cd vraptor-jpa/
git remote rm origin
git tag -l | xargs git tag -d
git filter-branch --prune-empty --subdirectory-filter vraptor-core/ -- --all
git reflog expire --expire=now --all
git gc --aggressive --prune=now
git update-ref -d refs/original/refs/heads/master
git repack -ad
git clone vraptor-jpa vraptor-jpa-main && cd vraptor-jpa-main
@garcia-jj
garcia-jj / ZipDownloadJDK7.java
Last active December 14, 2015 10:49
Downloading zipped files with VRaptor 4
package ot;
import static java.nio.file.Files.copy;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.zip.CRC32;
import java.util.zip.CheckedOutputStream;
import java.util.zip.ZipEntry;
@garcia-jj
garcia-jj / FormatadorDeBoletoThreadSafe.java
Created June 29, 2013 22:34
FormatadorDeBoletoThreadSafe
package br.com.caelum.stella.boleto.transformer;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
@garcia-jj
garcia-jj / ParanamerSynchronization.java
Created September 14, 2013 19:48
Paranamer thread-safety test
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import com.thoughtworks.paranamer.AnnotationParanamer;
@garcia-jj
garcia-jj / CreateObject.java
Last active December 24, 2015 01:49
Testes de performance entre instanciar objetos com Objenesis ou Reflection. Original: https://github.com/easymock/objenesis
/**
* Copyright 2006-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@garcia-jj
garcia-jj / InvokerReflectionTest.java
Last active December 24, 2015 06:39
Testes de performance entre Reflection e Invoker do Java 7
package br.com.caelum.vraptor.benchmark;
import java.lang.invoke.MethodHandle;
import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;