Skip to content

Instantly share code, notes, and snippets.

Avatar

Guillaume Husta ghusta

  • Toulouse, France
  • 11:23 (UTC +01:00)
  • Twitter @ghusta
View GitHub Profile
@ghusta
ghusta / JpaRepositoryItemReader.java
Created May 15, 2017
Spring Batch (ItemReader) + Spring Data JPA (JpaRepository) integration
View JpaRepositoryItemReader.java
import java.util.concurrent.CopyOnWriteArrayList;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.database.AbstractPagingItemReader;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
@ghusta
ghusta / JpaRepository.ftl
Created May 2, 2017
Spring Data JPA JpaRepository Freemarker Template for Hibernate Tools
View JpaRepository.ftl
/*
* Généré par Hibernate Tools ${version} le ${date}
* avec FreeMarker ${.version}
*/
${pojo.getPackageDeclaration()}
import ${pojo.getQualifiedDeclarationName()};
<#assign classbody>
<#assign pkType = pojo.getJavaTypeName(clazz.identifierProperty, true) />
@ghusta
ghusta / Dockerfile
Last active Feb 6, 2019
Tomcat 8 + Docker : add custom directory in classpath (Method #2 : define CLASSPATH in bin/setenv.sh)
View Dockerfile
FROM tomcat:8.5-jre8
# $CATALINA_HOME is defined in tomcat image
ADD target/my-webapp*.war $CATALINA_HOME/webapps/my-webapp.war
# Application config
RUN mkdir $CATALINA_HOME/app_conf/
ADD src/main/config/test.properties $CATALINA_HOME/app_conf/
# Create "$CATALINA_HOME/bin/setenv.sh"
@ghusta
ghusta / Dockerfile
Last active Aug 12, 2022
Tomcat 8 + Docker : add custom directory in classpath (Method #1 : modify conf/catalina.properties)
View Dockerfile
FROM tomcat:8.5-jre8
# $CATALINA_HOME is defined in tomcat image
ADD target/my-webapp*.war $CATALINA_HOME/webapps/my-webapp.war
# Application config
RUN mkdir $CATALINA_HOME/app_conf/
ADD src/main/config/test.properties $CATALINA_HOME/app_conf/
# Modify property 'shared.loader' in catalina.properties
@ghusta
ghusta / SimpleDateFormat_ThreadSafe.java
Last active Nov 24, 2016
SimpleDateFormat is not thread-safe, so give one to each thread [Java]
View SimpleDateFormat_ThreadSafe.java
// SimpleDateFormat is not thread-safe, so give one to each thread
private static final ThreadLocal<SimpleDateFormat> DATE_FORMAT_ISO_DATE = new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyy-MM-dd"); //$NON-NLS-1$
}
};
@ghusta
ghusta / mvn-install-file
Last active Oct 18, 2016
Maven : Installing Secondary Artifacts (jar, sources, javadoc)
View mvn-install-file
mvn install:install-file -Dfile=my-sources.jar -DgroupId=commons-dbcp -DartifactId=commons-dbcp -Dversion=1.2 -Dpackaging=jar -Dclassifier=sources
@ghusta
ghusta / gist:344b14b4d6f7f99baa69380cea5a5519
Last active Jun 17, 2016 — forked from AliMD/gist:3344523
All github Emoji (Smiles)
View gist:344b14b4d6f7f99baa69380cea5a5519

All github Emoji (Smiles)

ali.md/emoji

:bowtie: | 😄 | 😆 | 😊 | 😃 | ☺️ | 😏 | 😍 | 😘 | :kissing_face: | 😳 | 😌 | 😆 | 😁 | 😉 | :wink2: | 👅 | 😒 | 😅 | 😓

😩 | 😔 | 😞 | 😖 | 😨 | 😰 | 😣 | 😢 | 😭 | 😂 | 😲 | 😱 | :neckbeard: | 😫 | 😠 | 😡 | 😤 | 😪 | 😋 | 😷

😎 | 😵 | 👿 | 😈 | 😐 | 😶 | 😇 | 👽 | 💛 | 💙 | 💜 | ❤️ | 💚 | 💔 | 💓 | 💗 | 💕 | 💞 | 💘 |

@ghusta
ghusta / LocalDateToDateConverter.java
Created Jun 10, 2016
Dozer Converter to convert org.joda.time.LocalDate to java.util.Date.
View LocalDateToDateConverter.java
package ...util.dozer.converters.time;
import java.util.Date;
import org.dozer.DozerConverter;
import org.joda.time.LocalDate;
/**
* <b>Converter Dozer</b> : Convert a {@link LocalDate} to {@link Date}.
*/
@ghusta
ghusta / EnumUtils.java
Created Mar 30, 2016
Utils for Enums with Java 5
View EnumUtils.java
import java.lang.reflect.Field;
import org.apache.commons.lang.StringUtils;
/**
* Inspiré de {@link com.google.common.base.Enums} et {@link org.apache.commons.lang3.EnumUtils}.
*/
public class EnumUtils
{
@ghusta
ghusta / BigDecimalComparison.java
Last active Mar 23, 2016
Comparison of BigDecimal, working with Builder Pattern (isLessThan, isGreaterThan, etc)
View BigDecimalComparison.java
package fr.husta.util.bigdecimal;
import java.math.BigDecimal;
public class BigDecimalComparison
{
/**
* Initiate the comparison.
*