Skip to content

Instantly share code, notes, and snippets.

View elucidator's full-sized avatar
🏠
Working from home

Pieter van der Meer elucidator

🏠
Working from home
View GitHub Profile
@elucidator
elucidator / ConfigurationFactory.java
Created March 7, 2014 14:57
Full implementation of the ConfigurationFactory
/**
* Factory for providing configuration from a properties file
*/
@Startup
@Singleton
public class ConfigurationFactory {
private static final String APPLICATION_PROPERTIES = "application.properties";
private Properties configData;
private static final Logger LOGGER = LogManager.getLogger(ConfigurationFactory.class);
@elucidator
elucidator / NamedProperty.java
Created March 7, 2014 15:02
Gist for the NamedPRoperty Annotation
@Retention(RUNTIME)
@Target({FIELD, METHOD})
@Qualifier
public @interface NamedProperty {
/**
* key or name of the property
*
* @return a valid key or ""
*/
@Nonbinding String key() default "";
@WebMethod(
action = "ServiceName",
operationName = "operation")
public MyResponse operation(
@WebParam(
mode = WebParam.Mode.INOUT,
header = true,
name = "JaxbHeader",
targetNamespace = "http://www.elucidator.nl/header/v1.0")
final Holder headerHolder,
<plugin>
<groupId>org.codehaus.mojo</groupId
<artifactId>jaxb2-maven-plugin</artifactId
<version>1.6</version>  
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>    
<definitions xmlns:ns1="..." xmlns:tns="..."
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
name="MyService"
targetNamespace="..."
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
//SNIP
</types>
@elucidator
elucidator / Git submodule
Created November 11, 2015 12:12
Creation of a submodul
git submodule add https://github.com/elucidator/builder-annotations
@elucidator
elucidator / streamingdatafx.DataStreamParser.java
Created November 15, 2015 11:59 — forked from james-d/streamingdatafx.DataStreamParser.java
Demo of a JavaFX application which is updated by data streaming in. Created as a solution to https://community.oracle.com/message/12694944#12694944. There are two components: the main application, which consists of a server waiting for messages of the form "speed=<value>", an FXML file, FXML controller, and a main class that creates the server, …
package streamingdatafx;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@elucidator
elucidator / JsonSizePoc.scala
Created April 7, 2016 14:41
Gist for some marshalling and effect on the size of the resulting string
import java.io.ByteArrayOutputStream
import java.time.{Instant, ZonedDateTime}
import java.util.zip.GZIPOutputStream
import spray.json._
import scala.util.Random
case class SensorRecord(timestamp: ZonedDateTime, sensor1: Int, sensor2: Int, sensor3: Int, sensor4: Int, sensor5: Int, sensor6: Int, sensor7: Int, sensor8: Int, sensor9: Int, sensor10: Int, sensor11: Int)
@elucidator
elucidator / sample.json
Created April 22, 2016 13:36
Json sample data
{
"exerciseId": 4321,
"end": "2016-04-12T12:49:12.123",
"start": "2016-04-12T12:39:12.123",
"gloveId": 1234,
"data": [
{
"timestamp": "2016-04-12T12:39:12.123",
"sensorAngles": {
"thumb": {
@elucidator
elucidator / git-branches-by-commit-date.sh
Created June 2, 2016 12:57 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r