Skip to content

Instantly share code, notes, and snippets.

Rory McDaniel rorymcdaniel

  • Frederick, MD
Block or report user

Report or block rorymcdaniel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rorymcdaniel
rorymcdaniel / .htaccess
Created Jun 22, 2017
Pull Uploads from Production in WordPress staging environment
View .htaccess
# /wp-content/uploads/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://www.yourproductionserver.com/wp-content/uploads/$1 [L]
@rorymcdaniel
rorymcdaniel / link_core_wp_files.sh
Created Mar 8, 2017
Deployment Script for Pagely VPS and Envoyer
View link_core_wp_files.sh
View deleteEmptyFiles.php
<?php
/**
* Recursively searches the current directory and deletes any file that has only an opening PHP tag and empty lines
* Thanks to Jan for providing the solution here:
* https://stackoverflow.com/questions/44185401/delete-file-containing-opening-php-tag-and-empty-lines
*/
$directory = new RecursiveDirectoryIterator('./');
$iterator = new RecursiveIteratorIterator($directory);
@rorymcdaniel
rorymcdaniel / generatecert.sh
Last active May 1, 2017
Generate a self signed certificate for development and make Chrome trust it
View generatecert.sh
#!/bin/bash
# Usage: generatecert.sh domainname.dev
# Generates a key and self signed certificate, then requires Linux Chrome to trust the certificate
# Dependency: libnss3-tools (sudo apt install libnss3-tools)
if (( $EUID != 0 )); then
echo "Please run again with sudo"
exit
fi
@rorymcdaniel
rorymcdaniel / .bashrc
Created Apr 26, 2017
Sync a remote WordPress database with local
View .bashrc
# this assumes you have a WP CLI alias set up for your production environment already
# https://roots.io/leveraging-wp-cli-aliases-in-your-wordpress-development-workflow/
# Just add this to your ~/.bashrc for unix or ~/.bash_profile for Mac
alias syncwpdb='wp @production db dump - > production.sql && wp db reset --yes && wp db import production.sql && rm production.sql'
@rorymcdaniel
rorymcdaniel / wordpress_uploads.conf
Created Mar 14, 2017
Fix for http error on upload on WordPress on Nginx
View wordpress_uploads.conf
# save this file to /etc/nginx/forge-conf/example.com/server/
client_max_body_size 100m;
@rorymcdaniel
rorymcdaniel / deleteMenuItem.php
Last active Mar 7, 2017
Deletes a specified menu item from all sites on all networks on a WordPress multisite.
View deleteMenuItem.php
<?php
// Script must be run with wp eval-file
if(!defined('ABSPATH')){
die('You shall not pass.');
}
class DeleteSpecifiedWordPressMenuItem {
protected $menuNameToBeDeleted;
@rorymcdaniel
rorymcdaniel / downloadpdf.conf
Created Feb 24, 2017 — forked from JPry/nginx.conf
Nginx - Force PDFs to download
View downloadpdf.conf
location ~* /(.*\.pdf) {
types { application/octet-stream .pdf; }
default_type application/octet-stream;
}
@rorymcdaniel
rorymcdaniel / forge-nginx-wp-multisite.conf
Created Feb 23, 2017
Nginx conf file to be placed in /etc/nginx/forge-conf/domainname/server/ on a Laravel Forge provisioned server
View forge-nginx-wp-multisite.conf
# THis is for WordPress subdirectory multsite
rewrite ^/(wp-.*.php)$ /wp/$1 last;
rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last;
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) /wp$1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ /wp$1 last;
}
@rorymcdaniel
rorymcdaniel / BlogController.php
Last active Nov 23, 2016 — forked from tobysteward/BlogController.php
Laravel AJAX Pagination with JQuery
View BlogController.php
<?php
class BlogController extends Controller
{
/**
* Posts
*
* @return void
*/
public function showPosts()
You can’t perform that action at this time.