Skip to content

Instantly share code, notes, and snippets.

View jdboachie's full-sized avatar
☘️
Learning & Building

Jude Boachie jdboachie

☘️
Learning & Building
View GitHub Profile
@jdboachie
jdboachie / localSync.ts
Created February 6, 2026 11:04
syncs a given writable signal to local storage (angular)
import { Injectable, Signal, WritableSignal, effect } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class LocalSync {
init<T>(storageKey: string, target: WritableSignal<T>): LocalSync {
const raw = localStorage.getItem(storageKey);
if (!raw) {
return this;
interface ValidationResult {
passed: boolean;
violations: string[] | null;
}
type ValidatorFn = (input: string) => ValidationResult;
const validators: ValidatorFn[] = [];
const isDigit = (char: string) => {
from __future__ import annotations
import contextlib
import math
from dataclasses import dataclass
from PySide6.QtCore import (
QEasingCurve,
QPointF,
QRect,
from PySide6.QtGui import QGuiApplication, QPalette
from PySide6.QtWidgets import QApplication
def get_theme_mode() -> str:
"""Return 'dark' or 'light' based on the current system/application theme."""
if QApplication.instance() is None:
raise RuntimeError("QApplication instance not found. Initialize it first.")
palette = QGuiApplication.palette()
bg_color = palette.color(QPalette.ColorRole.Window)
import gi # type:ignore
import os
import csv
import time
import glob
import logging
import fractions
import subprocess
import tkinter as tk