Skip to content

Instantly share code, notes, and snippets.

@javathought
javathought / DateManager.java
Created June 27, 2019 14:08
DateManager / freezing for test
package gca.caps.gb.commun.services;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class DateManager {
public static final DateTimeFormatter FORMATTER_LOG = DateTimeFormatter.ofPattern("dd/MM/yyyy - HH:mm");
private static final DateManager instance = new DateManager();
@javathought
javathought / .editorconfig
Created June 21, 2019 14:44
editorconfig
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
[*.xml]
indent_size = 2
@javathought
javathought / .mavenrc
Created March 14, 2019 01:14
Maven Conf on Windows for emoji ...
LANG=en_US.UTF-8
@javathought
javathought / .gitlab-ci.yml
Created March 8, 2019 16:36 — forked from daicham/.gitlab-ci.yml
A sample of .gitlab-ci.yml for a gradle project
image: java:8-jdk
stages:
- build
- test
- deploy
before_script:
# - echo `pwd` # debug
# - echo "$CI_BUILD_NAME, $CI_BUILD_REF_NAME $CI_BUILD_STAGE" # debug
@javathought
javathought / JAXBDemo.scala
Created January 25, 2018 08:15
scala + jaxb
package io.github.javathought.commons.xml
import java.io.StringWriter
import javax.xml.bind.JAXBContext
import javax.xml.bind.annotation._
import javax.xml.bind.annotation.adapters.{XmlAdapter, XmlJavaTypeAdapter}
import io.github.javathought.commons.xml.XmlTypes._
import org.apache.commons.io.IOUtils
package gca.caps.rh.sourcing.dates
import java.time.format.DateTimeFormatter
import java.time.{DayOfWeek, LocalDate}
import org.slf4j.LoggerFactory
/**
* Vérification des jours fériés
*/
@javathought
javathought / StopWatch.java
Created August 7, 2017 16:56
Perf meter for test & micro benchmark
public class StopWatch {
private static final double NANOS_IN_A_MINUTE = 1000000000000F;
private static final double NANOS_IN_A_SECOND = 1000000000F;
private static final double NANOS_IN_A_MILLI = 1000000F;
private static final double NANOS_IN_A_MICRO = 1000F;
private long startTime = -1L;
private long startDate = -1L;
private long elapsedTime = -1L;
@javathought
javathought / Couchbase Array
Last active June 30, 2017 09:43
Couchbase memento
select {"artsist": artist, "rating": array rate.rating for rate in ratings end}
from couchmusic2
where type = "track"
limit 10;
select { "title": t.title, "rating": avg(r.rating)} as moy
from couchmusic2 as t
unnest t.ratings as r
group by t.title
@javathought
javathought / LogCaller.java
Created May 11, 2017 20:11
unit test Log calls in Java with PowerMock
/**
* call logs
*/
public class LogCaller {
private static Logger LOG = LoggerFactory.getLogger(LogCaller.class);
public void testLogging() {
LOG.info("Hello World");
}
@javathought
javathought / gherkin-fr.xml
Created January 20, 2017 20:14
Notepad++ highlighting for Gherkin
<NotepadPlus>
<UserLang name="Gherkin" ext="feature" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="yes" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00# 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>