Skip to content

Instantly share code, notes, and snippets.

View pholser's full-sized avatar

Paul Holser pholser

View GitHub Profile
@pholser
pholser / regex-crossword.mzn
Created March 17, 2021 02:27
MiniZinc model to solve a regex crossword
% https://jimbly.github.io/regex-crossword/
enum LETTER = {
A, B, C, D, E, F, G, H, I, J, K, L, M,
N, O, P, Q, R, S, T, U, V, W, X, Y, Z
};
array[1..7] of var LETTER: row1;
array[1..8] of var LETTER: row2;
array[1..9] of var LETTER: row3;
private void drawInfo(Graphics g) {
if (ClosetApp.ref.getFloorView() == null) {
return;
}
Drawing drawing = ClosetApp.ref.getFloorView().drawing();
Optional<Customer> customer = ofNullable((Customer) drawing.getUserData());
g.setColor(Color.black);
@pholser
pholser / ResolvingGenericParameterTypesTest.java
Created December 15, 2015 17:57
Possibly a bug in generics resolution library?
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import ru.vyarus.java.generics.resolver.GenericsResolver;
import static org.junit.Assert.*;
@pholser
pholser / FailoverProxyFactoryBean.java
Created October 26, 2015 19:12
Dressed up old factory bean in Java >= 7 clothes
import com.containerstore.common.base.exception.SystemException;
import com.google.common.collect.Iterables;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.log4j.Logger;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.remoting.support.RemoteAccessor;
import java.lang.reflect.InvocationTargetException;
package com.pholser;
import static java.lang.Float.*;
import static java.lang.Math.*;
public class FloatingPointFun {
public static void main(String[] args) {
showFloats();
}
package com.pholser.fn;
import org.junit.Before;
import org.junit.Test;
import java.sql.Date;
import java.util.Arrays;
import java.util.List;
import static com.pholser.fn.Functions.*;