Skip to content

Instantly share code, notes, and snippets.

View JonathanXDR's full-sized avatar
:atom:
work smart, not hard

Jonathan Russ JonathanXDR

:atom:
work smart, not hard
View GitHub Profile
@JonathanXDR
JonathanXDR / build-trigger.sh
Last active March 3, 2024 12:41
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=$VITE_GITHUB_TOKEN
GITHUB_REPO_BRANCH=${GITHUB_REPO_BRANCH:-develop}
BUILD_INTERVAL_MINUTES=${BUILD_INTERVAL_MINUTES:-30}
commits_info=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/repos/$VITE_GITHUB_REPO_OWNER/$VITE_GITHUB_REPO_NAME/commits?sha=$GITHUB_REPO_BRANCH&per_page=2")
echo -e "$commits_info\n"
@JonathanXDR
JonathanXDR / component-merge.sh
Last active March 3, 2024 12:40
A shell script for quickly converting Vue multi-file components into single-file components.
#!/bin/bash
cd "$(dirname "$0")/../components"
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 / Octicon.vue
Last active February 28, 2024 12:13
A Vue component built with the composition API & script setup to render @primer/octicons SVGs easily in your projects.
<script setup lang="ts">
import rawIconsData from '@primer/octicons/build/data.json'
import { computed, defineProps, onMounted, watch, withDefaults } from 'vue'
interface IconSVG {
tag: string
attrs: {
[key: string]: any
}
}