View conflict.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# No conflict, changes in branch time order. | |
mkdir merge-conflict1 | |
cd merge-conflict1 | |
git init | |
touch test1.sh | |
git add test1.sh | |
echo $'Start\nOne\n\n\n\nTwo\n\n\n\nThree\n\n\n\nFour\n\n\n\nEnd' > test1.sh | |
git commit -am 'initial commit on master test1.sh' |
View remove_valet.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
valet stop | |
composer global remove laravel/valet | |
composer global remove weprovide/valet-plus | |
brew services stop --all | |
brew uninstall dnsmasq | |
sudo rm -rf /usr/local/etc/dnsmasq.conf | |
sudo rm -rf /usr/local/Cellar/dnsmasq |
View exclude_posts_with_meta.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Exclude posts with 'fruit' custom meta field value of 'bananas' from site Search | |
*/ | |
function cc_search_filter( $query ) { | |
if ( ! is_admin() && $query->is_main_query() ) { | |
if ( $query->is_search ) { | |
$query->set( 'meta_query', | |
array( | |
'relation' => 'OR', |
View exclude_posts_with_term.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Exclude posts with term 'bananas' from Search. | |
*/ | |
function cc_search_filter( $query ) { | |
if ( ! is_admin() && $query->is_main_query() ) { | |
if ( $query->is_search ) { | |
$query->set( | |
'tax_query', | |
array( |
View products_with_category.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
wp_posts.post_title AS Product, | |
wp_postmeta1.meta_value AS SKU, | |
wp_postmeta2.meta_value AS Price, | |
GROUP_CONCAT( wp_terms.name ORDER BY wp_terms.name SEPARATOR ', ' ) AS ProductCategories | |
FROM wp_posts | |
LEFT JOIN wp_postmeta wp_postmeta1 | |
ON wp_postmeta1.post_id = wp_posts.ID | |
AND wp_postmeta1.meta_key = '_sku' | |
LEFT JOIN wp_postmeta wp_postmeta2 |
View update_htaccess.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Update .htaccess to whitelist logo when modified in platform settings. | |
*/ | |
function cc_logo_htaccess() { | |
// Fire only on Platform Settings options page. | |
$screen = get_current_screen(); | |
if ( 'cc-configurator_page_cc-settings' === $screen->id && ( $_POST['acf']['field_576c2a5137029'] || $_POST['acf']['field_576c2a9e3702a'] ) ) { | |
// Store files in an array. |
View update_htpasswd.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Manage .htpasswd files | |
# Store script name for use in output. | |
me=$( basename $0 ) | |
# Utility function for exiting. |
View wp_cli.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# | |
# Description: | |
# This will deploy WordPress in the current directory. | |
# Without modification it: | |
# - will configure basic security: | |
# - remove initial user created | |
# - deploy 6G firewall in .htaccess | |
# - attempt to prevent user enumeration in .htaccess | |
# - protect sensitive files and disallow executables in /wp-uploads |
NewerOlder