Skip to content

Instantly share code, notes, and snippets.

View ghusta's full-sized avatar

Guillaume Husta ghusta

  • Toulouse, France
  • 12:02 (UTC +02:00)
  • X @ghusta
View GitHub Profile
@ghusta
ghusta / TransactionalCustom.java
Created October 24, 2018 07:05
Spring custom meta-annotation with redeclared attributes from meta-annotations
import org.springframework.core.annotation.AliasFor;
import org.springframework.transaction.annotation.Transactional;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Meta-annotation Spring.
@ghusta
ghusta / make_docker_cli_for_windows.sh
Created June 26, 2018 13:50
Build Docker CLI for Windows (docker.exe)
git clone https://github.com/docker/docker-ce.git
# List all tags (exclude the rc)
git tag --list 'v*-ce'
# Checkout desired version (tag)
git checkout 18.05.0-ce
# Build docker.exe CLI for Windows
cd components/cli
@ghusta
ghusta / index.jsp
Created May 2, 2018 12:26
JSP redirection preserving parameters
<%@ page contentType="text/html; charset=UTF-8" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:redirect url="/login.jsp">
<c:forEach items="${param}" var="entry">
<c:param name="${entry.key}" value="${entry.value}" />
</c:forEach>
</c:redirect>
@ghusta
ghusta / JacksonDeserializationSnakeCase.java
Created October 25, 2017 15:23
com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy
ObjectMapper specificObjectMapper = new ObjectMapper();
specificObjectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
specificObjectMapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false);
specificObjectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@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 / JodaTimeLocaleTest.java
Created June 29, 2017 11:09
Joda Time DateTime formatted according to Locale
import org.joda.time.DateTime;
import org.joda.time.LocalDateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.junit.Before;
import org.junit.Test;
import java.util.Locale;
/**
@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) />
@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 / 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 / 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: | 😫 | 😠 | 😡 | 😤 | 😪 | 😋 | 😷

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