Skip to content

Instantly share code, notes, and snippets.

View chrismccoy's full-sized avatar

Chris McCoy chrismccoy

View GitHub Profile
@chrismccoy
chrismccoy / gutenberg.txt
Last active September 26, 2025 12:19
Gutenberg Resources
Eliminate All Blocks from Editor
wp.data.dispatch( 'core/block-editor' ).resetBlocks([]);
How to Use WordPress Block Builder to Create Custom Page Layouts Easily
https://www.webfactoryltd.com/blog/how-to-use-wordpress-block-builder-to-create-custom-page-layouts-easily/
How to Extend or Create Variations for WordPress Blocks
https://getbutterfly.com/how-to-extend-or-create-variations-for-wordpress-blocks/
How to disable and lock Gutenberg blocks
@chrismccoy
chrismccoy / restapi.txt
Last active December 23, 2025 02:52
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 April 7, 2026 13:35
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"
# git alias to download single file from a repo in format of user/repo file
fetch-file = "!f() { out=\"${4:-$(basename \"$2\")}\"; if gh api \"repos/$1/contents/$2\" ${3:+-f ref=$3} --jq '.content' 2>/dev/null | base64 --decode > \"$out\" 2>/dev/null; then echo \"Downloaded $2 → $out\"; else echo \"Failed\"; rm -f \"$out\"; fi; }; f"
# git alias to download single file from a repo in the format of user/repo/file
fetch-file = "!f() { repo=\"$(echo $1 | cut -d/ -f1-2)\"; file=\"$(echo $1 | cut -d/ -f3-)\"; out=\"${3:-$(basename \"$file\")}\"; if gh api \"repos/$repo/contents/$file\" ${2:+-f ref=$2} --jq '.content' 2>/dev/null | base64 --decode > \"$out\" 2>/dev/null; then echo \"Downloaded $file → $out\"; else echo \"Failed\"; rm -f \"$out\"; fi;