Skip to content

Instantly share code, notes, and snippets.

View JLLeitschuh's full-sized avatar

Jonathan Leitschuh JLLeitschuh

View GitHub Profile
import org.bytedeco.javacpp.opencv_videoio;
/**
* Statically defined list of devices that opencv
* supports as WebCam devices.
*/
public enum SourceType {
ANY(opencv_videoio.CV_CAP_ANY, "AutoDetect"),
MIL(opencv_videoio.CV_CAP_MIL, "MIL proprietary drivers"),
@JLLeitschuh
JLLeitschuh / WebwareTeachingW3Accessibility.md
Last active November 2, 2015 18:59
Webware Teaching W3 Accessibility

Why Teach Accessibility?

The Web is an increasingly important resource in many aspects of life: education, employment, government, commerce, health care, recreation, and more. It is essential that the Web be accessible in order to provide equal access and equal opportunity to people with disabilities. An accessible Web can also help people with disabilities more actively participate in society.

-w3.org

  • Legally required for Goverment Websites
  • Apple was recently sued for not having iOS devices. Apple now has some of the best tablet accessibilty on the market.
  • eglecting a major portion of the population by not catering to the needs of these users.
private enum SupportedType {
NumberArray(Number[].class){
void putValue(NetworkTable table, String identifier, Object value){
}
};
private final Class clazz;
SupportedType(Class clazz){
@Override
public synchronized void setValueWithKey(String key) throws IOException, IllegalArgumentException {
final List<String> keys = getKeys();
if (keys.contains(key)) {
index = keys.indexOf(key);
loadImage(paths.get(index));
} else {
throw new IllegalArgumentException(key + " was an illegal key");
}
}
@JLLeitschuh
JLLeitschuh / CooldownRestartPolicy.java
Last active January 26, 2016 17:26 — forked from vladdu/CooldownRestartPolicy.java
Guava RestartableService
public class CooldownRestartPolicy implements ServiceRestartPolicy {
/**
* If restarting sooner than this, it's probably an unrecoverable error.
*/
public static final int RESTART_INTERVAL = 5000;
private long last;
private long interval = RESTART_INTERVAL;
public CooldownRestartPolicy() {
package edu.wpi.grip.core.operations.composite;
import com.google.common.eventbus.EventBus;
import edu.wpi.grip.core.Operation;
import edu.wpi.grip.core.sockets.InputSocket;
import edu.wpi.grip.core.sockets.OutputSocket;
import edu.wpi.grip.core.sockets.SocketHints;
import org.bytedeco.javacpp.opencv_core;
import org.bytedeco.javacpp.opencv_core.Mat;
@JLLeitschuh
JLLeitschuh / CVOperations.java
Last active May 19, 2016 20:13
Large list of openCV operations converted into GRIP.
package edu.wpi.grip.core.operations;
import com.google.common.collect.ImmutableList;
import com.google.common.eventbus.EventBus;
import com.google.inject.Inject;
import edu.wpi.grip.core.OperationMetaData;
import edu.wpi.grip.core.events.OperationAddedEvent;
import edu.wpi.grip.core.operations.opencv.CVOperation;
import edu.wpi.grip.core.operations.opencv.enumeration.FlipCode;
@JLLeitschuh
JLLeitschuh / Vector.java
Created March 9, 2018 17:11
Immutable Vector using Information Expert Pattern
class Vector {
private final int x, y, z;
public Vector(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public Vector crossProduct(Vector other) {
// Do your math here
@JLLeitschuh
JLLeitschuh / build.gradle
Created October 20, 2018 02:15
Spotbugs Discovery
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.4"
}
}
@JLLeitschuh
JLLeitschuh / SecurityPlugin.java
Last active October 20, 2018 03:10
A benign plugin.
package org.jlleitschuh.testing.security;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
public class SecurityPlugin implements Plugin<Project> {
@Override
public void apply(final Project target) {
target.getLogger().lifecycle("A security plugin");
}