Skip to content

Instantly share code, notes, and snippets.

@chrismccoy
chrismccoy / dirgit.sh
Created December 25, 2024 19:40
git repo dir compare
#!/bin/bash
mapfile -t repos < <(gh repo list --json name -q '.[].name' | sort)
exists_count=0
not_exists_count=0
non_existing=()
echo -e "Comparing GitHub repositories with local directories...\n"
@chrismccoy
chrismccoy / gutenberg.txt
Last active February 12, 2025 14:27
Gutenberg Resources
Eliminate All Blocks from Editor
wp.data.dispatch( 'core/block-editor' ).resetBlocks([]);
Filtering Blocks When allowed_block_types_all is a boolean
https://tomjn.com/2024/02/29/filtering-blocks-when-allowed_block_types_all-is-a-boolean/
Gutenberg / Block editor: Dynamically populate SelectControl, RadioControl or CheckboxControl options
https://bdwm.be/gutenberg-block-editor-dynamically-populate-selectcontrol-radiocontrol-or-checkboxcontrol-options/
Gutenberg: custom validation / how to prevent post from being saved
@chrismccoy
chrismccoy / restapi.txt
Last active October 28, 2024 06:18
WordPress REST API Resources
Disable REST Api without Plugins
https://rudrastyh.com/wordpress/disable-rest-api.html
Add featured image & alt text to WP REST API
https://allisontarr.com/2021/10/13/add-featured-image-alt-text-to-wp-rest-api/
Allow ALL cross origin requests to WordPress REST API
https://github.com/Shelob9/rest-all-cors
WordPress theme using Rest API and Vue.js
@chrismccoy
chrismccoy / gitcheats.txt
Last active February 4, 2025 02:44
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# make a private git repo public that is private with gh cli
gh repo edit --accept-visibility-change-consequences --visibility public
# sort list of git repos with gh cli
gh repo list --limit 300 --json name -q '.[].name' | sort