Skip to content

Instantly share code, notes, and snippets.

View anztrax's full-sized avatar
🎯
Focusing

andrew ananta gondo anztrax

🎯
Focusing
View GitHub Profile
@anztrax
anztrax / EncoderDecoderUtils.tsx
Created July 2, 2024 06:01
Encoder and Decoder Utils
import isEmpty from "lodash/isEmpty";
class EncoderDecoderUtils{
constructor() {
}
encodeBase64(data: string): string{
return Buffer.from(data).toString('base64');
}
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
class RangeRegulator(
initialValue: Int,
private val minValue: Int,
private val maxValue: Int,
) : ReadWriteProperty<Any?, Int> {
var fieldValue = initialValue;
class FillInTheBlankQuestion {
val questionText: String = ""
val answer: String = ""
val difficulty: String = ""
}
class TrueOrFalseQuestion {
val questionText: String = ""
val answer: Boolean = false
val difficulty: String = ""
@anztrax
anztrax / gist:b6ae83cc358bfe2a4a5376a316a04eef
Created May 25, 2025 15:52
Reset password for open-webui ( forgot password )
docker exec -it open-webui rm /app/backend/data/webui.db
@anztrax
anztrax / pick.ts
Created November 29, 2025 23:56
Simple Pick implementation in Typescript
type MyPick<T, K extends keyof T> = {
[key in K]: T[key]
}
@anztrax
anztrax / readonly.ts
Created November 30, 2025 00:05
Simple implementation of Readonly in Typescript
type MyReadonly<T> = {
readonly [A in keyof T]: T[A]
}
@anztrax
anztrax / TupleToObject.ts
Created November 30, 2025 00:13
Simple Implemention Tuple to Object
// this version using any
type TupleToObject<T extends readonly (keyof any)[]> = {
[A in T[number]]: A
}
@anztrax
anztrax / First.ts
Created November 30, 2025 00:20
Simple implementation of First Array in Typesscript
type First<T extends any[]> = T extends [infer P, ...unknown[]] ? P : never;
@anztrax
anztrax / ArrayLength.ts
Created November 30, 2025 00:25
Simple Implementation Got Length of Array in Typescript
type Length<T extends readonly unknown[]> = T['length']
@anztrax
anztrax / exclude.ts
Created November 30, 2025 00:32
Simple Implementation of Exclude in Typescript
type MyExclude<T, U> = T extends U ? never: T;