Skip to content

Instantly share code, notes, and snippets.

View dgrebb's full-sized avatar

Dan Grebb dgrebb

View GitHub Profile
@dgrebb
dgrebb / _daily.md
Last active November 27, 2024 23:04
Daily note template for Obsidian. Paste this into Obsidian while in "source" mode.

<%* tR += "---" %> tags:

  • "#n/daily"
  • "#n/notes"

<%* tR += tp.date.now("dddd", 0, tp.file.title, "YY.MM.DD") + ", " + tp.date.now("YY.MM.DD", 0, tp.file.title, "YY.MM.DD") %>

[[_Notes/Daily/<% tp.date.now("YY.MM.DD", -1, tp.file.title, "YY.MM.DD") %> Daily|← Yesterday]] | [[_Notes/Daily/<% tp.date.now("YY.MM.DD", 1, tp.file.title, "YY.MM.DD") %> Daily| Tomorrow →]]

@dgrebb
dgrebb / Dockerfile
Created August 27, 2024 03:22
Jira 10 Docker Container: Jira Software Data Center Edition with PostgreSQL 15
FROM atlassian/jira-software:10.0.0
@dgrebb
dgrebb / svelte.config.js
Created August 23, 2024 06:33
SvelteKit multi-alias Generator
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { resolve } from 'path';
function createAlias(paths) {
const aliases = {};
Object.entries(paths).forEach(([key, value]) => {
const keys = key.split(',').map((k) => k.trim());
keys.forEach((alias) => {
@dgrebb
dgrebb / .aliases
Last active June 9, 2024 22:03
Git `gcn!` alias — amend the last commit without prompting to edit or running git hooks
#!/usr/bin/env bash
alias gcn!='f() {
if git diff --cached --quiet && git diff --quiet; then
printf "No changes to commit\n"
else
if git diff --cached --quiet; then
printf "No files added to staging! Did you forget to run git add?\n" >&2
else
git commit --verbose --no-edit --amend --no-verify
@dgrebb
dgrebb / package.json
Created March 2, 2024 00:52
Commitizen config customization in package.json
{
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"cz": "cz",
"release": "standard-version --no-verify"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
@dgrebb
dgrebb / docker-burn.sh
Last active February 21, 2024 23:52 — forked from Jaid/dockerPurge.bash
docker burn
#!/usr/bin/env bash
set -e
set -o errexit
docker stop `docker ps -qa` > /dev/null 2>&1; ## Stop all running containers
docker buildx stop; ## Stop the buildx builder
docker system prune --all --force --volumes; ## Remove all volumes, images, and containers
docker buildx rm --all-inactive --force; ## Remove all buildx builders
docker buildx prune --all --force; ## Prune buildx builder caches
@dgrebb
dgrebb / obsidian-web-clipper.js
Last active January 29, 2024 03:01 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@dgrebb
dgrebb / getHighContrastColor.js
Created January 20, 2024 04:13
Forget about your worries and your strife — have a contrast calculator figure out the best color to use against another (black or white).
/**
* Calculates and returns a high-contrast color (either black or white)
* for optimal readability when displayed on top of the provided color.
* The function uses the luminance formula to determine the brightness
* of the input color and returns either black or white based on a
* luminance threshold.
*
* @param {string} hexColor - The hex code of the background color.
* Should be a valid hex color code starting with '#'
* and followed by six hexadecimal characters.
@dgrebb
dgrebb / action.yml
Last active January 17, 2024 05:41
Install and Cache Playwright from `package.json` Dependencies | GitHub Composite Action
name: "Install and Cache Playwright"
description: "Sets up a cache and/or installs Playwright and its browser binaries."
author: dgrebb
inputs:
WORKSPACE_ROOT:
description: "The workspace root."
required: true
runs:
@dgrebb
dgrebb / diff-test.sh
Last active December 31, 2023 07:16
JSON file diff test for GitHub Actions with property filtering of known dynamic property values
#!/bin/bash
# Filter known dynamic timestamped `test`, `testLog`, and `diffImage` properties
# Then compare results, and `exit 1` if newly generated report.json is different.
diff -q <(jq -S ". | del(.tests[].pair.test, .tests[].pair.testLog, .tests[].pair.diffImage)" test/__fixtures__/sanity-test.json) \
<(jq -S ". | del(.tests[].pair.test, .tests[].pair.testLog, .tests[].pair.diffImage)" test/configs/backstop_data/bitmaps_test/**/report.json)
if [[ $? == "0" ]]; then
exit 0