Skip to content

Instantly share code, notes, and snippets.

View dobsondev's full-sized avatar

Alex Dobson dobsondev

View GitHub Profile
@dobsondev
dobsondev / home-page-meta-boxes.php
Created September 24, 2019 17:38
Add meta boxes with WordPress editor boxes in them to your home page.
<?php
/**
* Create the meta boxes for the home as long as it is the home page template that is currently
* being used.
*
* https://wordpress.stackexchange.com/questions/82477/how-to-add-add-meta-box-to-specific-page-template
* https://developer.wordpress.org/reference/hooks/add_meta_boxes/
* https://developer.wordpress.org/reference/functions/get_post_meta/
* https://developer.wordpress.org/reference/functions/add_meta_box/
@dobsondev
dobsondev / flexbox-grid-example.html
Last active August 28, 2017 18:30
A flexbox based grid like one you would find in Foundation or Bootstrap
<h2 class="text-center">Regular Grid</h2>
<div class="grid-container container-padding">
<div class="grid grid-padding testing">
<div id="header" class="small-12 colm">
<p class="text-center">
SMALL-12
</p>
</div>
@dobsondev
dobsondev / install-wp-plugins.sh
Last active February 12, 2018 15:43
Installs the newest version of all the WordPress plugins I like to use on the sites I make for clients.
#!/bin/sh
# --------------------------------------------------------
# Purpose: Downloads and installs plugins that are defined
# in the array setup by the user.
# Author: Alex Dobson (https://github.com/SufferMyJoy)
# --------------------------------------------------------
# Define all the plugins I like to have using their folder names
PLUG[0]="all-in-one-wp-security-and-firewall"
PLUG[1]="comment-moderation-e-mail-to-post-author"
@dobsondev
dobsondev / Move-Files.sh
Created September 8, 2015 21:44
Find all files in this directory and its sub-directories and execute mv with target directory. For each file found to move them to current directory.
find . -mindepth 2 -type f -print -exec mv {} . \;
@dobsondev
dobsondev / Find-Files-Changed-In-Last-60-Minutes.sh
Created May 14, 2014 21:19
Find all files below current directory that have been modified in the last 60 mintues.
find . -type f -mmin -60
@dobsondev
dobsondev / Find-File-Names-Newline-Carriage-Return-Blank.sh
Created May 14, 2014 21:02
Finds a file with a newline, carriage return, or blank character in its name.
find . -name '*['$'\r'$'\n'$' '']*'
@dobsondev
dobsondev / Processes-Using-Internet.sh
Last active August 29, 2015 14:01
Shows you which processes are using the Internet on your machine.
lsof -P -i -n | cut -f 1 -d " " | uniq
@dobsondev
dobsondev / Delete-All-Files-Except-Some-Extenstions.sh
Last active February 12, 2018 15:43
Deletes all files in a directory except those with the extensions given.
find . -type f ! -name "*.<extension>" ! -name "*.<extension>" -delete
@dobsondev
dobsondev / dirdiff.sh
Last active August 29, 2015 14:01
Function for .bashrc that shows the differences between two directories.
# Shows the differences between two directories
function dirdiff {
diff <(cd "$1" ; ls -1 | sort) <(cd "$2" ; ls -1 | sort)
}
export -f dirdiff
@dobsondev
dobsondev / Differences-Between-Directories.sh
Created May 14, 2014 16:46
Show the differences between two directories.
diff <(cd dir1 ; ls -1 | sort) <(cd dir2 ; ls -1 | sort)