Skip to content

Instantly share code, notes, and snippets.

View crstauf's full-sized avatar
🤔
const THINKING = true;

Caleb Stauffer crstauf

🤔
const THINKING = true;
View GitHub Profile
@crstauf
crstauf / cssllc-enhancements.php
Last active March 28, 2020 05:21
WordPress enhancements
<?php
/**
* Description: WordPress enhancements from CSSLLC.
* Author URI: https://develop.calebstauffer.com
* Author: Caleb Stauffer
* Plugin URI: https://gist.github.com/crstauf/68b4d37ebdc0423d2275bce49527a2f4
*/
/**
* Action: wp_enqueue_scripts
@crstauf
crstauf / cssllc-helpers.php
Last active May 3, 2020 16:13
WordPress helpers
<?php
/**
* Description: WordPress helpers from CSSLLC.
* Author URI: https://develop.calebstauffer.com
* Author: Caleb Stauffer
* Plugin URI: https://gist.github.com/crstauf/46a29f046cfffcaf2829401ae0773c90
*/
if ( !function_exists( 'create_post_type_labels' ) ) {
@crstauf
crstauf / cssllc-cpt.php
Last active March 28, 2020 05:21
Abstract class for WordPress CPT registrars.
<?php
/**
* Abstract for CPT registrars.
*
* Description: Abstract class for WordPress CPT registrars from CSSLLC.
* Author URI: https://develop.calebstauffer.com
* Author: Caleb Stauffer
* Plugin URI: https://gist.github.com/crstauf/30ee826b9cd4f0044ba7b4febc3e9dbd
*/
@keesiemeijer
keesiemeijer / setup-phpunit.sh
Last active December 8, 2023 11:02
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, curl wget, rsync, git, subversion and composer.
#
# WordPress is installed in the `/tmp/wordpress` directory for use by PHPUnit.
# The WordPress test suite is installed in the `/tmp/wordpress-tests-lib` directory.
@johnbillion
johnbillion / wp_mail.md
Last active May 12, 2024 14:19
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail

@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@nicholasohrn
nicholasohrn / http-basic-cron-request.php
Created July 1, 2014 21:22
WP Cron with HTTP Basic Authentication
<?php
if(defined('WP_CRON_CUSTOM_HTTP_BASIC_USERNAME') && defined('WP_CRON_CUSTOM_HTTP_BASIC_PASSWORD')) {
function http_basic_cron_request($cron_request) {
$headers = array('Authorization' => sprintf('Basic %s', base64_encode(WP_CRON_CUSTOM_HTTP_BASIC_USERNAME . ':' . WP_CRON_CUSTOM_HTTP_BASIC_PASSWORD)));
$cron_request['args']['headers'] = isset($cron_request['args']['headers']) ? array_merge($cron_request['args']['headers'], $headers) : $headers;
return $cron_request;
}
@cecilemuller
cecilemuller / get_combinations.php
Created February 1, 2013 03:13
PHP: Get all combinations of multiple arrays (preserves keys)
<?php
function get_combinations($arrays) {
$result = array(array());
foreach ($arrays as $property => $property_values) {
$tmp = array();
foreach ($result as $result_item) {
foreach ($property_values as $property_value) {
$tmp[] = array_merge($result_item, array($property => $property_value));
}
@manastungare
manastungare / css-compress.php
Created May 7, 2012 00:23
On-the-fly CSS Compression
<?php
/**
* On-the-fly CSS Compression
* Copyright (c) 2009 and onwards, Manas Tungare.
* Creative Commons Attribution, Share-Alike.
*
* In order to minimize the number and size of HTTP requests for CSS content,
* this script combines multiple CSS files into a single file and compresses
* it on-the-fly.
*