Skip to content

Instantly share code, notes, and snippets.

View aparx's full-sized avatar

Vinzent Alexander aparx

View GitHub Profile
@aparx
aparx / reactQueryInfiniteMapper.ts
Last active January 25, 2023 01:26
Enables individual page data remapping and removal for a set of queries using react-query (only through useInfiniteQuery)
import {Query, QueryCache, QueryClient, QueryFilters} from "@tanstack/react-query";
import {InfiniteData} from "@tanstack/query-core/build/lib/types";
export type InfiniteQueryData<U, V> = InfiniteData<U | V | undefined>;
export type InfinitePageMapperParam<OldPageT, NewPageT> = {
page: OldPageT | NewPageT,
index: number,
param?: unknown,
query?: Query<unknown, unknown, InfiniteQueryData<OldPageT, NewPageT>>,
@graywolf336
graywolf336 / BukkitSerialization.java
Last active October 26, 2024 16:41
Serialize and deserialize the player's inventory, including armor and content.
/**
* Converts the player inventory to a String array of Base64 strings. First string is the content and second string is the armor.
*
* @param playerInventory to turn into an array of strings.
* @return Array of strings: [ main content, armor content ]
* @throws IllegalStateException
*/
public static String[] playerInventoryToBase64(PlayerInventory playerInventory) throws IllegalStateException {
//get the main content part, this doesn't return the armor
String content = toBase64(playerInventory);