Skip to content

Instantly share code, notes, and snippets.

@aleixmorgadas
aleixmorgadas / AbstractIntegrationTest.java
Created December 5, 2023 18:47
Signelton Abstract Integration Test to reuse a Testcontainer between test classes
package dev.aleixmorgadas;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.test.web.servlet.MockMvc;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Testcontainers;
@aleixmorgadas
aleixmorgadas / 0_README.md
Last active September 6, 2023 15:59
Testcontainers MongoDB with volume and fixed ports.

Testcontainers MongoDB with volume and fixed ports

For the example, I'm using SpringBoot in DevMode. It is the only mode I consider that makes sense to enable the volume mapping.

Remember to add .data/ to .gitignore

@aleixmorgadas
aleixmorgadas / .0_README.md
Created September 2, 2023 19:03
Mocking Storybook dependencies with vue3-vite

Mocking Storybook dependencies with vue3-vite

When you are using @storybook/vue3-vite and you are wondering how to mock external modules, here an example.

In this case, I will mock the Auth0-vue module so that I can render components without problems.

:information: The files have a $ to represent a folder because / it is not permited charater in a gitst

@aleixmorgadas
aleixmorgadas / 0_README.md
Last active September 6, 2023 04:07
Aggregate with MongoDB

Entity Event Sourced with Spring Boot and MongoDB

@aleixmorgadas
aleixmorgadas / README.md
Created July 29, 2023 11:33
Keychron VIA app Linux

Keychron VIA app Linux

Open chromium.

Go to https://usevia.app/

You might see the error:

Vid: 0x3434
@aleixmorgadas
aleixmorgadas / 0_README.md
Last active July 27, 2023 13:26
Refreshing Auth0 ManagementAPI token before it expires when using Spring Boot

Refreshing Auth0 ManagementAPI token before it expires.

The expectation here is that the token expiration is 24h. You can check it in Applications > API > Settings > Token Settings.

What I did is refreshing the token every 12 hours.

In my case, I use Spring Boot 3.

@aleixmorgadas
aleixmorgadas / 0_README.md
Last active June 28, 2023 05:16
Starting a FastAPI as a server mock

Using FastAPI as Server Mock

I wanted to start a real mock server with real instances that I could fine tune for my own needs.

I found a way to start the FastAPI to run the tests agains it, and then kill the uvicorn.

Here an example code 👍

image

@aleixmorgadas
aleixmorgadas / install-node-pulsar-client-m1.md
Created July 19, 2022 20:42
Install node pulsar-client in Apple Silicon M1/M2 Chip

Installing node pulsar-client

https://www.npmjs.com/package/pulsar-client

You might found an error like

...
ERR! install response status 404 Not Found on https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.6.2-node-v93-darwin-arm64.tar.gz
...

Keybase proof

I hereby claim:

  • I am aleixmorgadas on github.
  • I am aleixmorgadas (https://keybase.io/aleixmorgadas) on keybase.
  • I have a public key ASB5kmXGYTA_TqclOqV7nMvPgFn8yxWUfYOQJ5DMe_CKTAo

To claim this, I am signing this object:

@aleixmorgadas
aleixmorgadas / 1. Fallacies.md
Last active October 2, 2021 04:53
Distributed Systems Fundamentals Questions

Fallacy #1. The network is reliable

  • Why the pattern Client-Response might cause some troubles?
  • What are distributed objects?
  • How we can solve this problem?

Fallacy #2. Latency isn't a problem

  • How many calls do you do between services before replying a syncronous call to the end user?
  • Which pattern is more common in your application? Remote calls or messages?