Skip to content

Instantly share code, notes, and snippets.

View hegemanjr's full-sized avatar

Jeff Hegeman hegemanjr

View GitHub Profile
@hegemanjr
hegemanjr / custom-heading-colors.css
Last active January 7, 2025 10:44
Obsidian Custom Heading Colors
:root {
--faded-blue: #7fbbb3;
--faded-aqua: #83c092;
--faded-green: #a7c080;
--faded-yellow: #dbbc7f;
--faded-orange: #e69875;
--faded-red: #e67e80;
--faded-purple: #B99CD6;
--light-blue: #5a93a2;
@hegemanjr
hegemanjr / install-toolbox.sh
Last active December 3, 2022 03:05 — forked from greeflas/install-toolbox.sh
JetBrains Toolbox installation script for Ubuntu - https://www.jetbrains.com/toolbox/app/
#!/bin/bash
set -e
if [ -d ~/.local/share/JetBrains/Toolbox ]; then
echo "JetBrains Toolbox is already installed!"
exit 0
fi
echo "Start installation..."
@hegemanjr
hegemanjr / vagrant-goodhosts1.1.3.sh
Created July 22, 2022 11:28
Install specific version of Vagrant plugin
vagrant plugin install vagrant-goodhosts --plugin-version 1.1.3
@hegemanjr
hegemanjr / drop-orphaned-tables.php
Created November 2, 2021 12:50
Drop orphaned tables from WordPress multisite with multiple networks.
<?php
add_action('init', function (){
global $wpdb;
$db_schema = 'zuse';
$output = '';
$networks = get_networks();
$sites = array();
$site_ids = array();
$in_wp = array();
$not_in_wp = array();
@hegemanjr
hegemanjr / composer-update.sh
Created October 17, 2021 15:42
Update composer packages in WordPress theme and plugin directories
#!/bin/bash
composer update
for dir in {*,wp-content/plugins/*,wp-content/themes/*}
do
if [ -d $dir ]
then
pushd $dir
if [ -f composer.json ]
@hegemanjr
hegemanjr / functions.php
Last active October 5, 2021 23:24
WordPress - Create limited site owner role
<?php
add_action('after_setup_theme', function(){
if(!get_option('soes_roles_created')){
$site_owner_caps = get_role('administrator')->capabilities;
$unwanted_caps = array(
'activate_plugins' => true,
'delete_plugins' => true,
'install_plugins' => true,
@hegemanjr
hegemanjr / newTab.js
Created September 26, 2021 04:47
Open WordPress RSS feed block links in new tab
/** Add target="_blank" to RSS block links */
let rssTitles = document.getElementsByClassName('wp-block-rss__item-title');
let len = rssTitles.length;
for(let i=0; i<len; i++)
{
let link = rssTitles[i].getElementsByTagName('a')[0];
link.target = "_blank";
}
@hegemanjr
hegemanjr / block-rest-api.php
Last active May 27, 2021 18:29
Block REST API for non-logged in users
<?php
/**
* Plugin Name: 608 Software - Block REST API
* Plugin URI: https://608.software
* Description: Block REST API for users that are not logged in
* Author: 608 Software
* Version: 1.0.2
* Author URI: https://608.software
* Text Domain: soes-block-rest-api
@hegemanjr
hegemanjr / sitemap-hide-users.php
Created March 20, 2021 01:49
Hide user info from sitemap XML
<?php
// Hide user info from sitemap XML
add_filter( 'wp_sitemaps_add_provider', function ($provider, $name) {
return ( $name == 'users' ) ? false : $provider;
}, 10, 2);
@hegemanjr
hegemanjr / gtm_inject.php
Last active January 20, 2021 12:07
Add Google Tag Manager GTM without plugin
<?php
// Add Google Tag code which is supposed to be placed in the <head>.
function soes_inject_gtm_head() {
// Add GTM head tag
?>
<!-- Google Tag Manager -->
<!-- End Google Tag Manager -->
<?php