Skip to content

Instantly share code, notes, and snippets.

View scottnunemacher's full-sized avatar
😁
Doing the things

Scott Nunemacher scottnunemacher

😁
Doing the things
View GitHub Profile
@alphaolomi
alphaolomi / wordpress_docker.md
Created September 20, 2019 07:44
Wordpress & Docker

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

docker-compose up -d

# To Tear Down
docker-compose down --volumes
@wpsmith
wpsmith / composer-landing-pages.json
Last active July 13, 2021 15:42
WordPress: Rewrite Tutorial
{
"name": "wpsmith/post-type-taxonomy-rewrite",
"description": "Rewrite for {taxonomy}/{postname} rewrites.",
"type": "project",
"license": "GPLv2+",
"authors": [
{
"name": "Travis Smith",
"email": "[email protected]"
}
@onstatus
onstatus / backup_email.sh
Last active August 2, 2020 17:48
Backup and/or sync Maildir between old and new mail server. This script use Dovecot Dsync configuration.
#!/bin/bash
# This script require Dsync configuration
# https://wiki2.dovecot.org/Migration/Dsync
# - IMAP migration configuration
# - POP3 migration configuration
# Dsync can use master authentication (https://wiki2.dovecot.org/Authentication/MasterUsers)
NOW=$(date +"%m-%d-%Y")
SUBJECT="Email Backed Up - "$NOW""
EMAIL="[email protected]"
# Bash best practices and style-guide
Just simple methods to keep the code clean.
Inspired by [progrium/bashstyle](https://github.com/progrium/bashstyle) and [Kfir Lavi post](http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming/).
## Quick big rules
* All code goes in a function
* Always double quote variables
@luizbills
luizbills / example.php
Created May 18, 2017 13:07
Google Tag Manager in Elementor Canvas
// please, replace the GTM-XXXX
add_action( 'wp_head', 'custom_add_google_tag_manager_head', 0 );
function custom_add_google_tag_manager_head () {
?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXX');</script>
@Disassembler0
Disassembler0 / dovecot-archive.sh
Created May 14, 2017 13:27
dovecot-archive.sh
#!/bin/bash
USER="[email protected]"
RETENTION=120
ARCHIVE_ROOT="Archiv"
BOXES_TO_ARCHIVE=("INBOX" "Odeslaná pošta")
# Load all existing subfolders in BOXES_TO_ARCHIVE
BOXES=()
@jserrao
jserrao / scroll-checker.js
Last active May 25, 2021 20:24
Click anywhere to close an active off-canvas menu
/* SCROLL CHECKER
*
* Description:
* This function scans all incoming clicks.
* This allows users to easily click outside an active offcanvas menu.
*
*
* Usage:
* This function analyzes the kinds of clicks that could come a page and an offcanvas menu.
* It's checking for a hamburger menu, a menu closing mechanism, links in a menu and links on a page
@fliphess
fliphess / migrate-wordpress.sh
Last active October 31, 2022 20:42
Wordpress migrator script
#!/bin/bash
set -e
function die() { echo "$1"; exit 1; }
function action() {
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "@@@ $(date)"
echo "@@@ $1"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
@JRGould
JRGould / wpmdbpro-cli-remote-backup-script.sh
Last active October 29, 2022 00:09
WP Migrate DB Pro CLI Backup Script
#!/bin/bash
#
# Declare SITES as an associative array
declare -A SITES
# Format: SITES[WPMDB profile number]=backup_filename_base
SITES[1]=remote_backup_com
#SITES[2]=another_site_to_backup
#SITES[3]=my_other_blog
## These variables will be specific to the WordPress
@goodmami
goodmami / logging.bash
Last active May 6, 2024 18:24
Basic logging commands for Linux shell scripts
#!/bin/bash
##
## Simple logging mechanism for Bash
##
## Author: Michael Wayne Goodman <[email protected]>
## Thanks: Jul for the idea to add a datestring. See:
## http://www.goodmami.org/2011/07/simple-logging-in-bash-scripts/#comment-5854
## Thanks: @gffhcks for noting that inf() and debug() should be swapped,
## and that critical() used $2 instead of $1