Skip to content

Instantly share code, notes, and snippets.

View aVolpe's full-sized avatar
:electron:
Hacking

Arturo Volpe aVolpe

:electron:
Hacking
View GitHub Profile
@aVolpe
aVolpe / DateFormat.java
Last active May 9, 2019 11:42
DateFormat
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
@aVolpe
aVolpe / TestFormatProvider.java
Created September 14, 2013 02:21
TestFormatProvider.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import org.apache.commons.lang3.time.DateUtils;
@aVolpe
aVolpe / ServiceDefinitionRegister.java
Created October 18, 2013 20:06
ServiceDefinitionRegister.java
public class ServiceDefinitionRegister implements BeanFactoryPostProcessor {
Logger logger = LoggerFactory.getLogger(ServiceDefinitionRegister.class);
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory bf)
throws BeansException {
Map<String, Object> beans = bf.getBeansWithAnnotation(WebService.class);
for (Entry<String, Object> entry : beans.entrySet()) {
@aVolpe
aVolpe / RegisterServicesTest.java
Last active December 1, 2016 07:43
RegisterServicesTest.java
@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
public class RegisterServicesTest extends BaseTest {
@Configuration
static class ContextConfiguration extends BaseTestConfiguration {
@Bean
public ServiceDefinitionRegister serviceDefinitionRegister() {
return new ServiceDefinitionRegister();
/*
* @WatcherTest.java 1.0 Nov 4, 2013 Sistema Integral de Gestion Hospitalaria
*/
package py.una.med.base.test.test.replication.watchers;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import liquibase.change.Change;
@aVolpe
aVolpe / JACOCO config
Last active January 3, 2016 12:09
Configuración del plugin JACOCO para que genere los resultados de coverage en `target/jacoco.exec`
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>unit-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
@aVolpe
aVolpe / CameraGestures.cs
Created March 31, 2014 20:46
A simple script that manipulates the camera through TouchScript to move it around a object. (Can zoom and rotate too).
using System;
using TouchScript.Events;
using TouchScript.Gestures;
using TouchScript.Gestures.Simple;
using UnityEngine;
public class CameraGestures : MonoBehaviour {
public float Speed = 10f;
public float PanSpeed = 15f;
@aVolpe
aVolpe / Builder.java
Created April 22, 2014 13:53
LdapPassword Builder
String ldapPasswordEncoder(String string) {
Charset cs = Charset.forName(CharEncoding.UTF_8);
StringBuilder builder = new StringBuilder("{MD5}");
builder.append(new String(Base64.encode(DigestUtils.md5Digest(string
.getBytes(cs)))));
return builder.toString();
}
@aVolpe
aVolpe / TestTest.java
Last active August 29, 2015 14:01
23910328 Test
package py.una.volpe.test;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
@aVolpe
aVolpe / Test25504340.java
Last active August 29, 2015 14:05
StackOverflow question #25504340
import java.io.IOException;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;