Skip to content

Instantly share code, notes, and snippets.

View stefanofago73's full-sized avatar
💭
Software Designer, I like to build software, a little tormented soul

Stefano Fago stefanofago73

💭
Software Designer, I like to build software, a little tormented soul
View GitHub Profile

THE PROMPT

Act as a PHP Senior Software engineer: You master all modern PHP syntax, data structures, and constructs. temp = 0.4

You are provided with an EBFN grammar, as input, defined inside the tags """.

"""
Grammar ::= ( 
 'SINGLE-WORD' | 
@stefanofago73
stefanofago73 / chatgpt_against_DDD.md
Created November 28, 2023 12:57
This is a joke to create a post criticizing DDD but using ChatGPT

Navigating the Quirky Waters of Domain Driven Design: A Humorous Expedition

THE PROMPT

Act as an expert of Domain Driven Design, temp 0.4

Task:

  • Your task is to write a full-fledged blog post about all defects of Domain Driven Design using jokes and important quotes from Alberto Brandolini's posts, books and works.

Format:

@stefanofago73
stefanofago73 / DSL_Generated.java
Last active October 23, 2023 13:04
An example of ChatGPT prompt to generate the source code for a simple Domain Specific Language
/**
*
* Here we have the originating grammar
*
* Grammar ::= (
* 'SINGLE-WORD' |
* 'PARAMETERISED-WORD' '('[A-Z]+')' |
* 'WORD1' 'OPTIONAL-WORD'? |
* 'WORD2' ( 'WORD-CHOICE-A' | 'WORD-CHOICE-B' ) |
* 'WORD3'+
@stefanofago73
stefanofago73 / TypeClasses_Exampls.java
Created October 8, 2023 20:25
Are possible Haskell Typeclasses in Java?
//
// Empty Typeclass
//
interface Empty<A> {
A empty();
static Empty<Integer> emptyInt() {
return () -> 0;
}
@stefanofago73
stefanofago73 / CharSequences.txt
Last active February 10, 2023 10:04
Reasoning about CharSequence: my weird dreams.
Starting point:
https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/CharSequence.html
Points:
- This interface provides uniform, read-only access to many different kinds of char sequences.
- This interface does not refine the general contracts of the equals and hashCode methods. The result of testing two objects that implement CharSequence for equality is therefore, in general, undefined.
- toString method: Returns a string containing the characters in this sequence in the same order as this sequence.
So... Those point, in someway, dont' make me happy also if I consider what are the implementation... CharBuffer, StringBuilder, String...
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Supplier;
interface ListDefinition<R> extends Supplier<List<R>>{
default boolean canMutate() {
return false;
}
@stefanofago73
stefanofago73 / IceCreamFactory.java
Last active January 17, 2023 14:29
A study on extracting a list of values from a list of Optionals: What implementation? And why?
import static java.util.stream.Collectors.toList;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
/**
*
@stefanofago73
stefanofago73 / ForComp_ScalaPorting.java
Last active January 15, 2023 08:27
Porting Scala For-Comprehension usage examples in pure Java 8+ examples ( at least some interesting examples )
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Stream;
import static java.util.stream.Collectors.toList;
/**
*
* @author Stefano fago
@stefanofago73
stefanofago73 / MDC.md
Created August 30, 2022 07:33
A simple skeleton to render Microservice Design Canvas in Plantuml/Ditaa... You can also experimenting online for free with [ https://www.planttext.com/ ]

@startditaa

+-------------------+-------------------------------------------+
| Service Name | Description | | | | | | | | | | +-------------------+-------------------------------------------+ | Consumer Task / Capabilities | | |

import java.util.HashMap;
import java.util.function.Function;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.Random;
interface Visitable<R,T extends Visitable<R,?>> {