Skip to content

Instantly share code, notes, and snippets.

@Dr-TSNG
Dr-TSNG / MultiDelegateState.kt
Created February 7, 2022 14:50
Multiple delegate state with Jetpack Compose
package icu.nullptr.util.compose
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import kotlin.reflect.KProperty
class DelegateState<T>(initial: T, private val sideEffectSetter: (T) -> Unit) {
private var snapshot by mutableStateOf(initial)
@Dr-TSNG
Dr-TSNG / enc_str.cc
Created January 1, 2022 06:41 — forked from yujincheng08/enc_str.cc
Compile time encrypt string
#include "enc_str.h"
#include <cstdio>
static_assert(next_prime<next_prime<4>> == next_prime<4> && next_prime<4> == 5, "??");
static constexpr auto j = "I love vvb2060 and she's my wife."_senc;
static constexpr auto k = ".."_senc;
static constexpr auto l = j + k;
int main() {