Skip to content

Instantly share code, notes, and snippets.

View shawnhooper's full-sized avatar

Shawn Hooper shawnhooper

View GitHub Profile
shawnhooper / toot.js
Last active November 16, 2022 04:42
TamperMonkey script to replace the Mastodon "Publish!" button with a "Toot!" button
// ==UserScript==
// @name Toot
// @namespace
// @version 1.0
// @description Replace the Mastodon 4.0+ Publish button with "Toot"
// @author Shawn M. Hooper
// @match*
// @match*
// @icon
// @grant none
wp core download --version=4.5
wp core config --dbname=$1 --dbuser=root --dbhost=
wp db create
wp core install --skip-email --title="$1" --admin_user="shawn" --admin_password="shawn" --url=
wp theme install simone --activate
wp plugin delete hello
wp plugin install any-ipsum;
wp plugin install advanced-custom-fields --version=4.4.0 --activate
wp plugin install tinymce-advanced --activate
shawnhooper / count.php
Created September 8, 2021 19:20
Using the doesntExist() method in Laravel
// This works
if ( 0 === $model->where('status', 'pending')->count() ) {
// But since I don't care about the count, just that there isn't one
// Laravel's exists() method is cleaner.
if ( ! $model->where('status', 'pending')->exists() ) {
shawnhooper / functions.php
Created September 3, 2020 23:01
WordPress - Disable saving in the customizer
/** Add this to the bottom of your functions.php file in your theme **/
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
remove_action('wp_ajax_customize_save', array($GLOBALS['wp_customize'], 'save'));
add_action('wp_ajax_customize_save', 'return_403_on_customizer_save');
function return_403_on_customizer_save() {
wp_send_json(array('message' => 'Theme Editor in Read Only Mode'), 403);

Keybase proof

I hereby claim:

  • I am shawnhooper on github.
  • I am shawnhooper ( on keybase.
  • I have a public key ASAFhJS9Tr2by7SoXaTbAFYjzMEqPCWZkwydY212qjsnUgo

To claim this, I am signing this object:

shawnhooper / defaul.conf
Created December 19, 2019 02:38
NGINX Config
server {
root /var/www/public;
listen 80;
location / {
index index.php;
try_files $uri $uri/ /index.php?$args;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
shawnhooper / tweetdeck-narrow-composer-bookmarklet.js
Created May 16, 2019 16:49
A bookmarklet to resize Tweetdeck's compose column after the May 2019 upgrade
wp db export
wp core update
wp plugin update --all
wp theme update --all
<div class="post-related col-xs-12 no-padding">
<div class="relatedposts col-md-10 col-md-offset-1">
<h3 class="relatedposts-title text-center">You might also like...</h3>
global $gemMightAlsoLike;
$recommended_posts = $gemMightAlsoLike->get_posts( get_the_ID() );
foreach ($recommended_posts as $recommended_post): ?>
<div class="relatedposts-item col-xs-12 col-sm-4 col-md-4">
shawnhooper / modify_rest_caps.php
Created December 2, 2015 04:46
Allow WordPress REST API to read a single post, by post status
add_filter( 'user_has_cap', array( __CLASS__, 'allow_rest_to_read_single_archived_module' ), 10, 3 );
* Modify the capabilities of the REST API to view a single
* "module" post if requested with its post ID.
* @param $allcaps
* @param $cap
* @param $args