Skip to content

Instantly share code, notes, and snippets.

View ghusta's full-sized avatar

Guillaume Husta ghusta

  • Toulouse, France
  • 00:28 (UTC +01:00)
  • X @ghusta
View GitHub Profile
@ghusta
ghusta / FluentSetterTemplate
Created March 18, 2016 11:15
Fluent Setter template for IntelliJ
#set($paramName = $helper.getParamName($field, $project))
public ##
#if($field.modifierStatic)
static void ##
#else
$classname ##
#end
with$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))($field.type $paramName) {
#if ($field.name == $paramName)
#if (!$field.modifierStatic)
@ghusta
ghusta / BigDecimalComparison.java
Last active March 23, 2016 09:50
Comparison of BigDecimal, working with Builder Pattern (isLessThan, isGreaterThan, etc)
package fr.husta.util.bigdecimal;
import java.math.BigDecimal;
public class BigDecimalComparison
{
/**
* Initiate the comparison.
*
@ghusta
ghusta / EnumUtils.java
Created March 30, 2016 13:34
Utils for Enums with Java 5
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 / LocalDateToDateConverter.java
Created June 10, 2016 11:42
Dozer Converter to convert org.joda.time.LocalDate to java.util.Date.
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 / gist:344b14b4d6f7f99baa69380cea5a5519
Last active June 17, 2016 08:47 — forked from AliMD/gist:3344523
All github Emoji (Smiles)

All github Emoji (Smiles)

ali.md/emoji

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

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

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

@ghusta
ghusta / mvn-install-file
Last active October 18, 2016 14:22
Maven : Installing Secondary Artifacts (jar, sources, javadoc)
mvn install:install-file -Dfile=my-sources.jar -DgroupId=commons-dbcp -DartifactId=commons-dbcp -Dversion=1.2 -Dpackaging=jar -Dclassifier=sources
@ghusta
ghusta / SimpleDateFormat_ThreadSafe.java
Last active November 24, 2016 12:59
SimpleDateFormat is not thread-safe, so give one to each thread [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 / Dockerfile
Last active August 12, 2022 20:39
Tomcat 8 + Docker : add custom directory in classpath (Method #1 : modify conf/catalina.properties)
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 / Dockerfile
Last active February 6, 2019 18:19
Tomcat 8 + Docker : add custom directory in classpath (Method #2 : define CLASSPATH in bin/setenv.sh)
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 / JpaRepository.ftl
Created May 2, 2017 15:10
Spring Data JPA JpaRepository Freemarker Template for Hibernate Tools
/*
* 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) />