Skip to content

Instantly share code, notes, and snippets.

View tedyoung's full-sized avatar

Ted M. Young tedyoung

View GitHub Profile
## Postfix templates for use with Custom Postfix Templates plugin for IntelliJ IDEA
# combines .new with .var
.nv : new var
CLASS → $expr$ $var:suggestVariableName()$ = new $expr$();$END$
package dev.ted.junit;
import org.junit.jupiter.api.DisplayNameGenerator;
import java.lang.reflect.Method;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ReplaceCamelCase extends DisplayNameGenerator.Simple {
private final static Pattern CAMEL_CASE_BOUNDARY = Pattern.compile("(([A-Z]?[a-z]+)|([A-Z]))");
@tedyoung
tedyoung / justfile for tdd using Maven Daemon (mvnd)
Last active July 25, 2022 19:56 — forked from gregorriegler/justfile for tdd and tcr
justfile for continuous testing and tcr
# justfile (see https://just.systems/man/en/ for docs on "just")
goal +MESSAGE:
git pull --rebase
git commit --allow-empty -m "Goal: {{MESSAGE}}"
git push
commit:
@git add .
-@git commit -am "wip"
@tedyoung
tedyoung / surround.xml
Created July 6, 2022 15:39
My favorite IntelliJ IDEA + AssertJ Surround templates. Add these to your "surround.xml" file in your "templates" directory.
<templateSet group="surround">
<template name="attb" value="org.assertj.core.api.Assertions.assertThatThrownBy(() -&gt; {$SELECTION$}).isInstanceOf($EXCEPTION$);$END$" shortcut="NONE" description="Surround with assertThatThrownBy" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="EXCEPTION" expression="descendantClassesEnum(&quot;Exception&quot;)" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_CODE" value="true" />
</context>
</template>
<template name="ast" value="assertThat({$SELECTION$})&#10; .$END$" shortcut="NONE" description="Surround with assertThat" toReformat="true" toShortenFQNames="true">
<context>
<option name="JAVA_CODE" value="true" />
@tedyoung
tedyoung / ddd-tactical-concept-map
Last active March 6, 2022 01:40
Concept Map of DDD Tactical Patterns
flowchart TD
app[Application Layer]
domain[Domain Layer]
agg[Aggregate]
entity[Entity]
repo[Repository]
vo["Value Object"]
aggroot["Aggregate Root"]
service[Service]
factory[Factory]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import javax.swing.*;
import java.awt.Color;
import java.awt.event.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.Scanner;
import java.awt.Font;
Take a look at these two classes:
```
class Equity {
public Equity(String name) {
}
}
class Stock extends Equity {
}
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
class BlockTokens {
public static void main(String[] args) {
String text = "Block one.\n" +
"Still part of block one.\n" +
"Yep, still part of block one.\n" +
"\n" +
@tedyoung
tedyoung / CodeFence.java
Last active June 19, 2019 00:24
replaceAll using DOTALL mode
String text =
"```\n" +
"public class Stock {\n" +
"\n" +
"}\n" +
"```\n";
text = text.replaceAll("(?s)```(.*?)```", "<pre>$1</pre>");
System.out.println(text);