Skip to content

Instantly share code, notes, and snippets.

View geowarin's full-sized avatar

Geoffroy Warin geowarin

View GitHub Profile
@geowarin
geowarin / index.html
Last active December 30, 2015 20:28
html: basic html5 template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My Page</title>
<meta name="description" content="My page">
<meta name="author" content="geowarin">
<link rel="stylesheet" href="css/styles.css?v=1.0">
@geowarin
geowarin / log4j.properties
Created December 12, 2013 21:44
Basic log4j.properties
log4j.appender.Stdout=org.apache.log4j.ConsoleAppender
log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.Stdout.layout.conversionPattern=%-5p - %-c - %m\n
log4j.rootLogger=INFO,Stdout
@geowarin
geowarin / persons.xml
Last active August 29, 2015 13:55
Xml snippet to illustrate article on xpath
<persons>
<person name='Joe' age='26'>
<project name='dom4j' language='java'/>
<project name='underscore' language='javascript'/>
<project name='ember' language='javascript'/>
</person>
<person name='Jane' age='23'>
<project name='dom4j' language='java'/>
</person>
<person name='Kevin' age='15'>
@geowarin
geowarin / compiler-pom.xml
Created April 1, 2014 21:28
maven compiler
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
@geowarin
geowarin / persistence.xml
Created April 7, 2014 06:36
Hsqldb persistence
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0">
<persistence-unit name="persistence" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>entity.Employee</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:MyDB/SAMPLE"/>
@geowarin
geowarin / SpringBootHelloworld.java
Created April 11, 2014 07:17
Spring boot hello world ;)
package hello;
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;
@Controller
@EnableAutoConfiguration
public class SpringBootHelloworld {
@geowarin
geowarin / DbUnitServiceTest.java
Created April 11, 2014 07:33
Sample test for dbUnit
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { TestConfig.class })
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class, DbUnitTestExecutionListener.class })
@DatabaseSetup("setup.xml")
public class ServiceTest {
@Test
@ExpectedDatabase("assert.xml")
@geowarin
geowarin / Procfile
Last active August 29, 2015 14:00
Running a jar on heroku with java 8
web: java $JAVA_OPTS -jar target/*.jar
@geowarin
geowarin / logback.xml
Created May 27, 2014 16:55
Spring boot default
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<logger name="org.springframework.boot" level="INFO"/>
<logger name="org.springframework.security" level="ERROR"/>
<logger name="org.glassfish.jersey" level="INFO"/>
</configuration>
@geowarin
geowarin / LogRule.java
Created June 13, 2014 09:21
Junit rule that allows capturing Logs output in the Class under test during unit testing
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,