Skip to content

Instantly share code, notes, and snippets.

🚀

Jan-Willem Gmelig Meyling JWGmeligMeyling

🚀
Block or report user

Report or block JWGmeligMeyling

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ComparatorUtil.java
package com.pallasathenagroup.util;
import java.util.Comparator;
import java.util.Optional;
/**
* Comparator utility methods for handling optional comparable.
*/
public class ComparatorUtil {
@JWGmeligMeyling
JWGmeligMeyling / TableCollector.java
Last active Jan 16, 2017
Guava Table Collector
View TableCollector.java
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.google.common.collect.Table.Cell;
import com.google.common.collect.TreeBasedTable;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Value;
import lombok.experimental.Accessors;
import java.util.Collections;
@JWGmeligMeyling
JWGmeligMeyling / MergeUtil.java
Created Nov 7, 2016
Merge functions for solving duplicate keys in toMap collectors
View MergeUtil.java
package nl.meylingmedia.util;
import java.util.Comparator;
import java.util.function.BinaryOperator;
import java.util.function.Function;
/**
* Merge functions for solving duplicate keys in toMap collectors.
*
* @see java.util.stream.Collectors#toMap(Function, Function, BinaryOperator)
@JWGmeligMeyling
JWGmeligMeyling / README.md
Created May 29, 2016
Angular bind checkbox model to array
View README.md

Angular bind checkbox model to array

Angular model formatter and parser pair that transforms a set of checkboxes to an array filled with arbitrary values.

Usage

<input type="checkbox" ng-model="ctrl.myModel" data-multi-select-value="::arrayValue">
@JWGmeligMeyling
JWGmeligMeyling / DatabaseTestModule.java
Created May 18, 2016
Persisting recursive relationships with Hibernate
View DatabaseTestModule.java
package org.hibernate.test;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.inject.persist.PersistService;
import com.google.inject.persist.jpa.JpaPersistModule;
public class DatabaseTestModule extends AbstractModule {
View Calculator.java
package nl.tudelft.cucumber;
import java.io.Closeable;
public class Calculator implements Closeable {
public int add(int a, int b) {
return a + b;
}
@JWGmeligMeyling
JWGmeligMeyling / DateTest.java
Created Jan 20, 2016
Some tests on basic assumptions on Java's LocalDateTime
View DateTest.java
import org.junit.Test;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.Month;
import java.time.ZoneId;
import static org.junit.Assert.assertEquals;
/**
@JWGmeligMeyling
JWGmeligMeyling / search-param.js
Created Nov 22, 2015
Location search parameters for Angular
View search-param.js
/**
* Angular Module that exposes the search parameters for the current window location.
* For example: http://localhost/?test=1
* Exposes: $searchParams.test === 5
* This is different than the search method in the $location service, which only exposes search params set in the location hash.
*
*/
angular.module('org.searchparams').service('$searchParams', function() {
window.location.search.substring(1)
.split("&")
@JWGmeligMeyling
JWGmeligMeyling / MultimapCollector.java
Last active Feb 14, 2019
Collectors for Guava Multimaps
View MultimapCollector.java
package nl.tudelft.ewi.gitolite.config.util;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.TreeMultimap;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Value;
@JWGmeligMeyling
JWGmeligMeyling / DatabaseModule.java
Last active Jul 31, 2016
Test Guice projects using the JPAPersistModule with Jukito
View DatabaseModule.java
import javax.persistence.EntityManager;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.inject.persist.PersistService;
import com.google.inject.persist.jpa.JpaPersistModule;
public class DatabaseModule extends AbstractModule {
You can’t perform that action at this time.