Skip to content

Instantly share code, notes, and snippets.

@falkoschumann
falkoschumann / extension.md
Created March 28, 2024 20:22
Visual Studio Code Extensions
@falkoschumann
falkoschumann / .eslintrc.json
Last active April 20, 2024 09:57
Node.js project starter
{
"env": {
"es2022": true,
"browser": true,
"cypress/globals": true
},
"extends": ["eslint:recommended", "plugin:cypress/recommended"],
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module"
@falkoschumann
falkoschumann / MessageBus.java
Last active August 9, 2023 18:52
Simple message bus for in process communication.
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
public class MessageBus {
private static final MessageBus DEFAULT = new MessageBus();
private final List<Consumer<Object>> consumers = new CopyOnWriteArrayList<>();
@falkoschumann
falkoschumann / .editorconfig
Last active April 16, 2024 16:02
Common files for a new project.
# EditorConfig is awesome: https://EditorConfig.org
# Based on following Google Style Guides:
# - C++: https://google.github.io/styleguide/cppguide.html
# - C#: https://google.github.io/styleguide/csharp-style.html
# - Go: https://google.github.io/styleguide/goguide.html
# - HTML/CSS: https://google.github.io/styleguide/htmlcssguide.html
# - JavaScript: https://google.github.io/styleguide/jsguide.html
# - Java: https://google.github.io/styleguide/javaguide.html
# - Python: https://google.github.io/styleguide/pyguide.html
@falkoschumann
falkoschumann / uninstall-pkg.sh
Created February 20, 2023 18:13
Uninstall macOS pkg
#!/usr/bin/env bash
# list all installed packages
# > pkgutil --pkgs
packageid=$1
set -e
cd /
@falkoschumann
falkoschumann / ConfigurableResponses.java
Last active May 12, 2023 18:16
Java test helper classes
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
public class ConfigurableResponses<T> {
private final Object response;
private ConfigurableResponses(Object value) {
response = value;
}
@falkoschumann
falkoschumann / EventEmitter.java
Last active May 12, 2023 18:16
This is a utility class that can be used by beans that emit events.
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
public class EventEmitter<T> {
private final List<Consumer<T>> listeners = new CopyOnWriteArrayList<>();
public EventEmitter() {
// public ctor
@falkoschumann
falkoschumann / projektverzeichns.md
Last active December 19, 2020 09:31
Projektverzeichnis

Projektverzeichnis

Eine beispielhafte Verzeichnisstruktur für Projekte

  • Projekt 1
    • 1 Projektmanagement
      • 1 Angebot und Kalkulation
      • 2 Korrespondenz
  • 3 Rechnung
@falkoschumann
falkoschumann / FxmlView.java
Last active July 20, 2023 19:24
Using JavaFX view and view controller with factory method.
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
public class FXMLControllerFactory {
private FXMLControllerFactory() {}
public static <T> T newController(Class<T> controllerType, Stage stage) {
var filename = "/%s.fxml".formatted(controllerType.getSimpleName());
try {
var url = controllerType.getResource(filename);
@falkoschumann
falkoschumann / build.gradle
Last active October 20, 2023 19:45
Gradle project starter
import org.apache.tools.ant.filters.FixCrLfFilter
import java.time.LocalDate
plugins {
id 'application'
id 'checkstyle'
id 'jacoco'
id 'java'
id 'com.diffplug.spotless' version '6.20.0'