Skip to content

Instantly share code, notes, and snippets.

View oowekyala's full-sized avatar

Clément Fournier oowekyala

  • TU Dresden
  • Dresden, Germany
  • 19:34 (UTC +02:00)
View GitHub Profile
@oowekyala
oowekyala / BaseComparatorTest.java
Last active January 8, 2020 17:08
Generic contract test for a class implementing java.util.Comparator
import static java.lang.Integer.signum;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
/** A generic test class to test the contract of a Comparator. */
public abstract class BaseComparatorTest<T> {
@oowekyala
oowekyala / README.md
Last active August 6, 2019 13:05
GSoC 2017 report -- Bringing Object-Oriented Metrics to PMD
import spoon.Launcher;
import spoon.reflect.declaration.CtClass;
import spoon.support.sniper.SniperJavaPrettyPrinter;
public class MWE {
/*
<dependency>
<groupId>fr.inria.gforge.spoon</groupId>
<artifactId>spoon-core</artifactId>
@oowekyala
oowekyala / MetricReporter.java
Created May 22, 2019 20:23
Generic metric reporter for PMD
package net.sourceforge.pmd.lang.metrics.internal;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import net.sourceforge.pmd.RuleContext;
import net.sourceforge.pmd.lang.ast.Node;
@oowekyala
oowekyala / app.css
Created July 15, 2018 12:50
Removing scroll arrows on JavaFX context menu
// Works at least on JFX 8 and 9
.context-menu .scroll-arrow {
-fx-padding: 0 0 0 0;
}
.context-menu .menu-item {
// OK this is weird but it does solve a padding bug on the context menu.
// Without it, items are offset to the bottom, and the last one is partially hidden
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://pmd.github.io/index.html</loc>
<priority>1</priority>
<changefreq>monthly</changefreq>
<lastmod>2018-05-18</lastmod>
</url>
@oowekyala
oowekyala / App.java
Last active March 27, 2018 23:37
MWE RTFX style overlay
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import org.fxmisc.richtext.InlineCssTextArea;
import org.fxmisc.richtext.model.StyleSpans;
import org.fxmisc.richtext.model.StyleSpansBuilder;
import javafx.application.Application;
import javafx.scene.Scene;
@oowekyala
oowekyala / fix-mvn
Created March 20, 2018 12:36
Fix PMD maven import setting all the modules to 1.7
#!/bin/bash
sed -i -e 's/1.5/1.7/g' .idea/compiler.xml
find . -name "*.iml" -exec sed -i -e 's/LANGUAGE_LEVEL="JDK_1_5"/LANGUAGE_LEVEL="JDK_1_7"/g' {} +
@oowekyala
oowekyala / pmd-jekyll.sh
Created August 23, 2017 14:04
Simple screen launcer for the PMD jekyll site
#!/bin/bash
# Assuming GNU screen and bundler are installed, and `bundle install` has been run,
# this script starts the PMD documentation site server as a background screen.
# Kill the screen with option -k or --kill
# Install: change the PMD_GIT_DIR to match your pmd working directory, put in path and make executable
PMD_GIT_DIR="$HOME/Documents/Git/pmd"
SCRIPT_NAME=$(basename $0)