Skip to content

Instantly share code, notes, and snippets.

View benweidig's full-sized avatar

Ben Weidig benweidig

View GitHub Profile
@benweidig
benweidig / tynamo-security-jakarta.patch
Created October 1, 2024 06:04
tapestry-tynamo with Tapestry 5.9.0-preview-2
diff --git a/pom.xml b/pom.xml
index 919ff8a..3a0816f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
</parent>
<properties>
- <tapestry-release-version>5.7.2</tapestry-release-version>
+ <tapestry-release-version>5.9.0-preview-2</tapestry-release-version>
@benweidig
benweidig / gist:06e71b299c5707d4f04a75c0323b1b12
Created April 11, 2024 05:28
Figure 6-4: Flow of Book elements through the Stream pipeline
Type of Return
Operation Stream Operations Type
─────────────────────────────────────────────────────────────────────────────────────────────────────
┌──────────────────────────────────────────────────────────────┐
Source │ Book Book Book Book Book Book Book Book Book │ List<Book>
└─────────────────────────────┬────────────────────────────────┘
v
┌──────────────────────────────────────────────────────────────┐
@benweidig
benweidig / typecoercers-jsr310-proposal.md
Created October 16, 2020 07:54
Tapestry Java Time / JSR310 Type Coercer proposal

Java Time API / JSR310 Type Coercers

Date: 2020-10-16
Author: Ben Weidig

Summary

Add JSR310 / Java Time CoercionTuples to Tapestry.

Either<Integer, String> result = doWork();
result.apply(errorCode -> log.error("Error {} occuring during work", errorCode),
value -> log.info("Success: {}", value));
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
public class Either<L, R> {
public static <L, R> Either<L, R> left(L value) {
return new Either<>(value, null);
}
interface FileLoader {
Optional<String> loadContent() throws IOException;
}
interface FileLoader {
String loadContent() throws FileNotFoundException;
}
try {
// might throw IOException
doWork();
doMoreWorkRequireingCleanup();
}
catch (IOException e) {
throw new RuntimeExcetpion(e)
}
finally {
try {
// might throw IllegalArgumentException
doWork();
// might throw ArithmeticException
doMoreWork();
}
catch (IllegalArgumentExcetion e) {
// handle exception
}
try {
doWork();
}
catch (Exception e) {
// NO-OP
}