Skip to content

Instantly share code, notes, and snippets.

@fResult
fResult / HighEntropy.kt
Created November 1, 2025 17:12
High-Entropy VS Low-Entropy in Spring Cloud Gateway
@Configuration
@Profile("routes-filter")
class FilterConfiguration {
companion object {
private val log = Loggers.getLogger(FilterConfiguration::class.java)
}
@Bean
fun filterGateway(builder: RouteLocatorBuilder): RouteLocator =
builder.routes()
@fResult
fResult / changes.diff
Last active September 21, 2025 11:30
Git diff (source/main…HEAD) capturing my personal code notes for Medium post“Personal Notes: Documenting PR Changes with AI (no Agent mode version).”
diff --git a/README.md b/README.md
index ced9bd0..d30d6ec 100644
--- a/README.md
+++ b/README.md
@@ -53,6 +53,9 @@ Each module is implemented in both [Java](./java) and [Kotlin](./kotlin) to comp
- Implemented parallel Kotlin versions of Java examples
- Updated to Spring Boot 3.5.x while the book uses an older Spring Boot version 2.5.0
- Adopted a monorepo approach with [Gradle Multi-project Builds][gradle-multiproject] and [Gradle Composite Builds][gradle-composite-builds] to manage both Java and Kotlin implementations in a single repository
+ - Learned that Gradle Kotlin DSL supports both type-safe and string-based dependency declarations, and that the string-based form was required
+ in [`08:rsocket/build.gradle.kts`](./kotlin/08-rsocket/build.gradle.kts) when adding dependencies inside `afterEvaluate`
@fResult
fResult / PricingDiscountApp.java
Last active June 3, 2025 10:36
Example for the article https://fresult.medium.com/31014f433b49 and POC Strategy Design Pattern
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
class PricingDiscountApp {
public static void main(String[] args) {
final var customer1 = new Customer("1", "John Doe", CustomerType.VIP);
final var customer2 = new Customer("2", "Jane Doe", CustomerType.REGULAR);
final var customer3 = new Customer("3", "Business Corp", CustomerType.BUSINESS);
import java.time.LocalDateTime;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
class DocumentProcessorApp {
public static void main(String[] args) {
final var trinity = new Submitter("trin123");
final var morpheus = new Approver("morph456");
import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collector;
import java.util.stream.Collectors;
class TripAnalyzerApp1 {
private static final List<Trip> TRIPS = List.of(
new Trip(TripType.BUSINESS, "Tokyo", Duration.ofHours(5),LocalDateTime.of(2025, 5, 25, 8, 0), "Thomas Anderson", new BigDecimal("1200.00")),
import static java.time.temporal.ChronoUnit.HOURS;
import java.time.Instant;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Function;
import java.util.function.Supplier;
@fResult
fResult / TestSecureResource1.java
Last active May 11, 2025 16:25
Try Union Type In Java
sealed interface Permission permits Read, Write {}
record Read() implements Permission {}
record Write() implements Permission {}
record Execute() {}
class ResourceAction {
public String perform(Permission permission) {
return String.format("Performing action with %s...", permission.getClass().getSimpleName());
}
@fResult
fResult / Customer.java
Last active April 20, 2025 13:29
Optional Demo for the article: https://medium.com/p/03845513d9f5 (You can see the whole code block at the file in the bottommost.)
// Basic domain record
public record Customer(String id, String email) {}
@fResult
fResult / LAB_FAILED.md
Last active March 11, 2025 14:15
Implement Load Balancing on Compute Engine Failed

GCP Skills Boost - Challenge Lab

Test Passed:

image

But check progress failed:

image

@fResult
fResult / MostAppearedDigitsProblem.java
Last active February 21, 2025 04:54
Solve the mostAppearedDigits without using `maximum` utility method
import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Stream;
class TestUtils {
public static <Expected, Actual> void test(Expected expectedResult, Actual actualResult) {
// System.out.printf("Expected=%s | Actual=%s\n", expectedResult, actualResult);
final var expectedResultOpt = Optional.ofNullable(expectedResult);
final var actualResultOpt = Optional.ofNullable(actualResult);