Skip to content

Instantly share code, notes, and snippets.

View SamWolfs's full-sized avatar
🧙‍♂️

Sam Wolfs SamWolfs

🧙‍♂️
View GitHub Profile
@SamWolfs
SamWolfs / delegate.go
Created October 16, 2022 05:57
Bubbles list: no full screen if secondary state
// prs/delegate.go
package prs
import (
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
)
func newItemDelegate(keys *delegateKeyMap) list.DefaultDelegate {
@SamWolfs
SamWolfs / App.java
Last active December 29, 2019 17:58
Parse partial JSON object
import com.google.gson.Gson;
public class App {
public static void main(String[] args) {
Gson gson = new Gson();
String json = "{\"type\":\"bankaccount\",\"payload\":{\"bankAccountNo\":\"BE123\"}}";
// String json = "{\"type\":\"newuser\",\"payload\":{\"firstName\":\"Sam\",\"lastName\":\"Wolfs\"}}";
Message msg = gson.fromJson(json, Message.class);
switch (msg.getType()) {
case "bankaccount":