Skip to content

Instantly share code, notes, and snippets.

View tunaitis's full-sized avatar

Simon Tunaitis tunaitis

View GitHub Profile
@tunaitis
tunaitis / cleanup.sh
Created December 8, 2024 20:20
A bash script to clean up all app data for testing macOS app's first launch experience
#!/bin/bash
# Configuration
APP_ID="com.your.app-id"
APP_NAME="YourAppName"
echo "🧹 Cleaning ${APP_NAME} data..."
# Clear preferences
defaults delete ${APP_ID} 2>/dev/null || true
@tunaitis
tunaitis / backup.sh
Created December 3, 2024 19:20
SQLite database rolling backup script with rclone
#!/bin/bash
DB_PATH="/path/to/sqlite/database.db" # Path to your SQLite database
TIMESTAMP=$(date +"%Y%m%d_%H%M%S") # Timestamp for the backup
ROLLING_LIMIT=30 # Number of backups to keep
BACKUP_DIR="/tmp" # Temporary local backup directory
BACKUP_NAME="backup_$TIMESTAMP.sqlite" # Backup filename
REMOTE_NAME="remote" # Name of your rclone remote
REMOTE_PATH="backups" # Remote bucket or folder
@tunaitis
tunaitis / tailwind.config.js
Last active October 6, 2024 06:08
This function generates custom color utility classes for any CSS property in Tailwind CSS. It extends Tailwind's color palette to properties not covered by default utilities, such as `stop-color` for SVG gradients or `caret-color` for text inputs.
function generateColorUtilities(cssProperty) {
return function({ addUtilities, theme }) {
const newUtilities = {}
Object.entries(theme('colors')).forEach(([key, value]) => {
if (typeof value === 'object') {
Object.entries(value).forEach(([shade, color]) => {
newUtilities[`.${cssProperty}-${key}-${shade}`] = {
[cssProperty]: color,
}
})