Skip to content

Instantly share code, notes, and snippets.

@jb510
jb510 / gist:0f49e427e421deddf1db0509fe7d2ca4
Created January 30, 2019 07:11
MySQL Get WordPress Autoload data report
SELECT 'autoloaded data in KiB' as name, ROUND(SUM(LENGTH(option_value))/ 1024) as value FROM wp_options WHERE autoload='yes'
UNION
SELECT 'autoloaded data count', count(*) FROM wp_options WHERE autoload='yes'
UNION
(SELECT option_name, length(option_value) FROM wp_options WHERE autoload='yes' ORDER BY length(option_value) DESC LIMIT 25)
@jb510
jb510 / strip_visual_composer_shotcode_vomit.php
Created January 25, 2019 02:52
Cleanup Visual Composer Vomit (strip vc shortcodes)
<?php
/**
* Strip Visual Composer Shortcode Vomit
*
* Main footer file for the theme.
*
* @package DevTools
* @author Jon Brown <jb@9seeds.com>
* @license https://www.gnu.org/licenses/gpl-2.0.txt GNU/GPLv2
* @link https://9seeds.com
@jb510
jb510 / readme.md
Last active October 17, 2025 17:13 — forked from nickcernis/readme.md
Exclude vcs (git, svn, hg) and node_modules from Backblaze backups on Mac

Backblaze's bztransmit process loads a file called bzfileids.dat into RAM. This file is a list of all files Backblaze has previously uploaded, including a unique identifier for each file. On most systems, this files is under 100MB in size (paraphrased from Backblaze support rep Zack).

Mine had grown to 6GB. This means that anytime bztransmit runs, it will load this 6GB file into RAM while it is backing up. In doing so it was purging massive ammounts of memory causing behavior like Chrome (usign 10GB of memory on it's own) to hang/beachball for 30 seconds and then refresh all it's windows.

There is no way to alter this behavior once it's begun, aside from starting over with some files excluded. The index needs to be rebuilt from scratch without the excessibe file count, that also means you can't restart and "inherit" a previous backup.

In my case the biggest culprits were .git and node_modules, so I excluded those, started a new backup (transfered licnese) and spent a week hunting for fast internet I could

@jb510
jb510 / 9seeds-gutenberg-style-guide.html
Created December 10, 2018 04:22
9seeds-gutenberg-style-guide.html
<!-- wp:paragraph {"customTextColor":"#6c7781","customFontSize":17} -->
<p style="color:#6c7781;font-size:17px" class="has-text-color"><em>It’s a whole new way to use WordPress. Try it right here!</em></p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":97629,"align":"full"} -->
<figure class="wp-block-image alignfull"><img src="https://wordpress.org/gutenberg/files/2018/07/Screenshot-4-1.png" alt="" class="wp-image-97629"/></figure>
<!-- /wp:image -->
<!-- wp:paragraph {"align":"left"} -->
<p style="text-align:left">We call the new editor Gutenberg. The entire editing experience has been rebuilt for media rich pages and posts. Experience the flexibility that blocks will bring, whether you are building your first site, or write code for a living.</p>
<!-- wp:paragraph {"customTextColor":"#6c7781","customFontSize":17} -->
<p style="color:#6c7781;font-size:17px" class="has-text-color"><em>It’s a whole new way to use WordPress. Try it right here!</em></p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":97629,"align":"full"} -->
<figure class="wp-block-image alignfull"><img src="https://wordpress.org/gutenberg/files/2018/07/Screenshot-4-1.png" alt="" class="wp-image-97629"/></figure>
<!-- /wp:image -->
<!-- wp:paragraph {"align":"left"} -->
<p style="text-align:left">We call the new editor Gutenberg. The entire editing experience has been rebuilt for media rich pages and posts. Experience the flexibility that blocks will bring, whether you are building your first site, or write code for a living.</p>
@jb510
jb510 / hide-metaboxes-by-user-role.php
Created June 1, 2018 12:05
Hide metaboxes by user role
<?php
//* Hide Extra Metaboxes from certian user roles
add_action( 'init', ‘s9_remove_layouts_templates_init', 99 );
function s9_remove_layouts_templates_init() {
if ( ! is_admin() ) {
return;
}
$allowed_roles = array( 'administrator', 'super-editor', 'editor', 'author' );
function my_capitalize_string($content) {
$content = str_replace('some string', 'SOME STRING',$content);
return $content;
}
add_filter('the_content','my_capitalize_string');
add_filter('the_excerpt','my_capitalize_string');
@jb510
jb510 / hellobar-wp-plugin.php
Last active June 30, 2017 16:21
Hello Bar (Offical) plugin for WordPress done properly
<?php
/*
Plugin Name: Hello Bar (Official - modified by 9seeds to only show when admin bar isn't and to WP code standards)
Plugin URI: http://www.hellobar.com
Description: Inserts your custom Hello Bar on mauitime.com. Because of the WordPress User Bar, you might need to log out and visit your WordPress site again to see your Hello Bar. Please note that this plugin is only valid for mauitime.com. If you want to edit your Hello Bar click "Visit plugin site" below.
Version: 1.0
Author: Hello Bar
Author URI: http://www.hellobar.com
License: GPL v2
@jb510
jb510 / Keybase proof
Created May 18, 2017 06:31
Keybase proof
### Keybase proof
I hereby claim:
* I am jb510 on github.
* I am jb510 (https://keybase.io/jb510) on keybase.
* I have a public key whose fingerprint is 5FB0 273D B8DF 60A9 84C8 EA18 F4A2 D989 A666 30EB
To claim this, I am signing this object:
@jb510
jb510 / styleguide.html
Last active May 10, 2017 13:53
Post Content HTML Style Guide for WordPress
Lorem <strong>something strong</strong> dolor <em>something emphasized</em>, <del>something struck through</del> adipiscing elit. <a href="http://wordpress.org">an actual link</a>, ipsum sed <span style="text-decoration: underline;">something underlined</span> gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat.
<h1>Header level one</h1>
Sed quis velit. Nulla facilisi. Nulla libero. Vivamus pharetra posuere sapien. Nam consectetuer. Sed aliquam, nunc eget euismod ullamcorper, lectus nunc ullamcorper orci, fermentum bibendum enim nibh eget ipsum. Donec porttitor ligula eu dolor. Maecenas vitae nulla consequat libero cursus venenatis. Nam magna enim, accumsan eu, blandit sed, blandit a, eros.
<h2>Header level two</h2>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Non quaeritur autem quid naturae tuae consentaneum sit, sed quid disciplinae. Et ille ridens: Video, inquit, quid agas; Duo