Skip to content

Instantly share code, notes, and snippets.

@andrewheiss
Last active December 3, 2025 20:34
Show Gist options
  • Select an option

  • Save andrewheiss/ef3ac7dfef2fdb8477a84e7e27f6853e to your computer and use it in GitHub Desktop.

Select an option

Save andrewheiss/ef3ac7dfef2fdb8477a84e7e27f6853e to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Create Positron playground project
# @raycast.mode silent
# Optional parameters:
# @raycast.argument1 { "type": "text", "placeholder": "Project folder name" }
# @raycast.icon 🛝
# Documentation:
# @raycast.description Create ~/Development/• Mini projects/• 2025 playground/MM/DD/<folder> and open in Positron
# @raycast.author andrewheiss
# Check if folder name is provided
if [ -z "$1" ]; then
echo "Error: No folder name provided"
exit 1
fi
# Get the current date in MM/DD format
current_date=$(date +%m/%d)
# And get it as ISO-8601 for the YAML
yaml_date=$(date +%Y-%m-%d)
# Build the full path
full_path="$HOME/Development/• Mini projects/• 2025 playground/$current_date/$1"
# Create the directory
mkdir -p "$full_path"
# Create index.qmd with template
cat > "$full_path/index.qmd" << EOF
---
title: "TITLE HERE"
date: $yaml_date
description: "DESCRIPTION HERE (150-160 characters)"
image: "img/BLAH.png"
twitter-card:
image: "img/BLAH.png"
open-graph:
image: "img/BLAH.png"
categories:
- SOMETHING
# doi: DOI HERE
citation: true
---
\`\`\`{r}
#| label: setup
#| include: false
knitr::opts_chunk$set(
fig.width = 6,
fig.height = 6 * 0.618,
fig.retina = 3,
dev = "ragg_png",
fig.align = "center",
out.width = "90%",
collapse = TRUE,
cache.extra = 1234 # Change number to invalidate cache
)
options(
digits = 4,
width = 300,
dplyr.summarise.inform = FALSE
)
\`\`\`
CONTENT HERE
EOF
# Open the folder in Positron
positron "$full_path"
@cbgoodman
Copy link

Slight improvement on the folder naming scheme. You can enter the title in sentence format (or whatever you want), and this will format into date-slug (first five words) and auto-title the post (use $1 as the title).

# Get the current date in ISO-8601 format
yaml_date=$(date +%Y-%m-%d)

# Format title
lower_string=$(echo "$1" | awk '{print tolower($0)}')
slug=$(echo "$lower_string" | awk '{for (i=1; i<5; ++i) str=sprintf("%s-%s",str,$i)}END{print str}')

# Build the full path
full_path="$HOME/website/blog/$yaml_date$slug"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment