Skip to content

Instantly share code, notes, and snippets.

View mobber007's full-sized avatar
🎯
Focusing

mobber007 mobber007

🎯
Focusing
View GitHub Profile
@mobber007
mobber007 / ubuntu_install.sh
Created February 11, 2023 00:30 — forked from nginx-gists/ubuntu_install.sh
Automating Installation of WordPress with NGINX Unit on Ubuntu
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ];then
>&2 echo "This script requires root level access to run"
exit 1
fi
if [ -z "${WORDPRESS_DB_PASSWORD}" ]; then
>&2 echo "WORDPRESS_DB_PASSWORD must be set"
>&2 echo "Here is a random one that you can paste:"
@mobber007
mobber007 / pvs-app.js
Last active September 15, 2021 16:06
install banner for pvs app
const createEventHub = () => ({
hub: Object.create(null),
emit(event, data) {
(this.hub[event] || []).forEach(handler => handler(data));
},
on(event, handler) {
if (!this.hub[event]) this.hub[event] = [];
this.hub[event].push(handler);
},
@mobber007
mobber007 / poc-2way.js
Created June 23, 2021 11:52
Vanilla js 2-way data binding POC
const buildState = (state) => {
return new Proxy(state, {
set(target, property, value) {
target[property] = value
renderDom()
return true
}
})
}
# case 1 - named parameters using flags
# this is named input parameters for bash
while getopts u:a:f: flag
do
case "${flag}" in
u) username=${OPTARG};;
a) age=${OPTARG};;
f) fullname=${OPTARG};;
esac
@mobber007
mobber007 / install-wp-cli.sh
Last active March 17, 2021 15:46
Installing an configuring WP-CLI
#!bin/bash
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --version
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
@mobber007
mobber007 / add-to-cart.php
Created March 4, 2021 14:11 — forked from lukecav/add-to-cart.php
WooCommerce Quantity Before Add to Cart and Product Update
<?php
/**
* Custom Loop Add to Cart.
*
* Template with quantity and ajax.
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
global $product;
@mobber007
mobber007 / Command
Created January 22, 2021 13:07 — forked from lukecav/Command
Delete ActionScheduler comments and scheduled-action post types in WooCommerce using WP-CLI
wp comment list --field=comment_ID --'comment_author'='ActionScheduler' --number=1000 | xargs wp comment delete --force
wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 | xargs wp post delete --force
wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 --post_status=trash | xargs wp post delete --force
wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 --post_status=cancel | xargs wp post delete --force
@mobber007
mobber007 / disable-comments.sh
Created January 13, 2021 10:24 — forked from jplhomer/disable-comments.sh
Disable all comments/pings in WordPress with WP-CLI
$ wp post list --format=ids | xargs wp post update --comment_status=closed
# Output:
# Success: Updated post 2514.
# Success: Updated post 2511.
# Success: Updated post 2504.
# Success: Updated post 2499.
# Success: Updated post 2441.
# etc...
@mobber007
mobber007 / php-pools.md
Created December 9, 2020 11:18 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@mobber007
mobber007 / functions.php
Created May 9, 2020 14:35 — forked from butlerblog/functions.php
SMTP using wp-config.php for settings
<?php // Don't use this line.
/**
* This function will connect wp_mail to your authenticated
* SMTP server. This improves reliability of wp_mail, and
* avoids many potential problems.
*
* For instructions on the use of this script, see:
* https://www.butlerblog.com/2013/12/12/easy-smtp-email-wordpress-wp_mail/
*