Skip to content

Instantly share code, notes, and snippets.

@0bx
0bx / VariantSerializationTest.java
Created June 26, 2024 20:12
Java (Pseudo) Union type with custom Jackson (de)serializer
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@0bx
0bx / WebSocketClient.ts
Last active April 29, 2021 09:04
Redux aware WebSocket client
/**
* Redux aware WebSocket client compatible with spring-boot-starter-websocket configuration
* It uses Stomp client over SockJS socket implementation. It allows for providing map of topic
* names to their respective handlers/callbacks. Handlers are called with custom props object
* that mixes Stomp properties with Redux state/dispatch.
*
* @author: https://github.com/0bx
**/
// Example usage:

Keybase proof

I hereby claim:

  • I am 0bx on github.
  • I am 0rh (https://keybase.io/0rh) on keybase.
  • I have a public key ASAbo5SkBYVBTrDPJD5N8UxluW4HdEiDYn9DlS6w8x--tgo

To claim this, I am signing this object: