Skip to content

Instantly share code, notes, and snippets.

@lao
lao / useIndexedDB.js
Created February 13, 2024 14:55
This file contains a custom hook for interacting with IndexedDB, a low-level API for client-side storage of significant amounts of structured data.
/**
* File: useIndexedDB.js
*
* This file contains a custom hook for interacting with IndexedDB, a low-level API for client-side storage of significant amounts of structured data.
*
* The hook takes three parameters:
* 1. `databaseName`: The name of the IndexedDB database you want to interact with.
* 2. `storeName`: The name of the object store in the database.
* 3. `key`: The key of the value you want to read or write in the object store.
*
@lao
lao / secret-santa.py
Created January 18, 2024 12:31
Tiny secret santa py
import datetime
import random
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
def secret_santa(names):
"""Assigns a Secret Santa for each person in the list avoiding cycles of two."""
# Check for a valid number of participants