Skip to content

Instantly share code, notes, and snippets.

View JonathanXDR's full-sized avatar
🚀
Nie nöd am büglä

Jonathan Russ JonathanXDR

🚀
Nie nöd am büglä
View GitHub Profile
@JonathanXDR
JonathanXDR / component-merge.sh
Last active October 6, 2024 19:42
A shell script for quickly converting Vue multi-file components into single-file components.
#!/bin/bash
cd "$(dirname "$0")/../components" || exit
if [ $? -ne 0 ]; then
echo "Error: Unable to navigate to the components directory."
exit 1
fi
find . -type f -name "*.vue" | while read vue_file; do
@JonathanXDR
JonathanXDR / build-trigger.sh
Last active October 6, 2024 19:40
A shell script to manage build triggers on Vercel by checking the time difference between the last two commits on a GitHub repository.
#!/bin/bash
GITHUB_TOKEN=$GITHUB_TOKEN
GITHUB_REPO_BRANCH=$GITHUB_REPO_BRANCH
BUILD_INTERVAL_MINUTES=${BUILD_INTERVAL_MINUTES:-30}
commits_info=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_REPO_OWNER/$GITHUB_REPO_NAME/commits?sha=$GITHUB_REPO_BRANCH&per_page=2")
echo -e "$commits_info\n"
@JonathanXDR
JonathanXDR / extract-components.ts
Last active October 12, 2024 11:00
A Bun script, which extracts JavaScript modules and their dependencies from a bundle.
interface ModuleInfo {
[index: number]: [Function, { [key: string]: number }];
}
interface DependencyNode {
moduleId: number;
dependencies: DependencyNode[];
}
async function parseModules(jsContent: string): Promise<ModuleInfo> {