Skip to content

Instantly share code, notes, and snippets.

@Webreaper
Webreaper / docker-compose.yml
Last active March 27, 2025 19:41
Sample Docker-compose file which shows how to set up Sonarr, Radarr, Prowlarr, Lidarr, QBittorrent and a VPN container so that all all traffic from the containers is routed through the VPN. Also includes Plex and get_iplayer containers, which are not routed through the VPN.
# Docker compose to set up containers for all services you need:
# VPN
# Sonarr, Radarr, Lidarr, Qbittorrent
# Non-VPN
# Plex, get_iplayer
# Before running docker-compose, you should pre-create all of the following folders.
# Folders for Docker State:
# /volume1/dockerdata. - root where this docker-compose.yml should live
# /volume1/dockerdata/plex - Plex config and DB
# /volume1/dockerdata/sonarr - Sonarr config and DB
@alexmustin
alexmustin / block-style-variations.js
Created August 5, 2020 19:08
WP - Add block style variations
jQuery(document).ready(function($) {
// Add 'Semibold' style to Paragraph blocks
wp.blocks.registerBlockStyle("core/paragraph", {
name: "semibold",
label: "Semibold"
});
// Add 'Black' style to Paragraph blocks
wp.blocks.registerBlockStyle("core/paragraph", {
@devinsays
devinsays / svg-icon-post.md
Last active May 27, 2021 10:37
How to Use an SVG for a Custom Post Type Icon

Let's use this id-card svg for the custom post type icon rather than a standard dashicon.

First, download the raw SVG file. If you open it up in a text editor, it should look something like this:

<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="id-card" class="svg-inline--fa fa-id-card fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M528 32H48C21.5 32 0 53.5 0 80v16h576V80c0-26.5-21.5-48-48-48zM0 432c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V128H0v304zm352-232c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zm0 64c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zm0 64c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zM176 192c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zM67.1 396.2C75.5 370.5 99.6 352 128 352h8.2c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h8.2c28.4 0 52.5 18.5
@devinsays
devinsays / tracking.php
Created April 24, 2020 15:49
Tracking Copy
<?php
/**
* Add GTM ecommerce tracking to the Order Complete (Thank You) page.
*
* @param int $order_id
*/
public function thank_you_tracking($order_id)
{
$user_id = get_current_user_id();
$is_existing_customer = $user_id ? get_user_meta($user_id, '_existing_customer', true) : false;
@christiaansnoei
christiaansnoei / acf-flexible-content.php
Last active January 20, 2022 10:51
Loop through each row of a flexible content field.
<?php
$flexible_content = '';
if( have_rows('partials', get_queried_object_id()) ):
while( have_rows('partials', get_queried_object_id()) ): the_row();
$row_layouts = [
'example-1',
'example-2',
'example-3',
];
const sql = require("../util/sql");
const Discord = require("discord.js")
const tools = require("../util/tools");
const challonge = require("challonge");
const Mong = require("../util/mong").Mong;
const {ObjectID} = require("mongodb");
const challongeClient = challonge.createClient({
apiKey:"***"
});
@thetwopct
thetwopct / image-handling-wordpress.php
Last active March 27, 2023 13:04
WordPress image handling (ACF / Background Images / Inline / srcset /
//
<?php
if ( has_post_thumbnail() ) {
echo wp_get_attachment_image(get_post_thumbnail_id($post->ID), '', false, array('class' => 'featured-image'));
} else {
echo '<img src="' . get_bloginfo( 'stylesheet_directory' )
. '/library/images/thumbnail-default.jpg" alt="default thumb" class="featured-image"/>';
}
?>
@thomasfw
thomasfw / _theme.scss
Last active August 11, 2022 11:48
Wordpress Gutenberg - Auto register a theme's color palette by parsing the stylesheet (uses `editor-color-palette`)
// Gutenberg Color Palette
// These are merged Bootstrap 4 $theme-colors from global variables.
// The compiled rules are also read and cached in 'functions.php'
// so they don't need to be registered manually.
$gutenberg-colors: map-merge( (
'dark' : #1A1A1A,
'green' : #68b678,
'red' : #E2574D,
), $theme-colors );
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active April 24, 2025 19:40
Conventional Commits Cheatsheet

Conventional Commit Messages starline

See how a minor change to your commit message style can make a difference.

Tip

Take a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs

Commit Message Formats

Default

@uamv
uamv / gf-map-class-to-post-meta.php
Last active January 22, 2024 10:54
Save Gravity Form field data to post meta by adding a class to the field.
<?php
/**
* Save Gravity Form field data to post meta by adding a class to any field.
* Meta is mapped so that it is readable by Advanced Custom Fields
* Format class as…
* post_meta-{meta_key} -- for simple fields & writing lists as array to single meta record
* post_meta-{meta_key}-.3 -- for multi-input fields
* post_meta-{repeater_key}-1.{meta_key} -- for list fields mapped to meta readable by ACF
*/
// Run this function after the Gravity Form has created a post