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 / 0_reuse_code.js
Created Jul 1, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rorymcdaniel
rorymcdaniel / precommit
Created Sep 1, 2015
A git precommit hook that looks for things like console.log, var_dump, etc and prevents the commit if found
View precommit
#!/usr/bin/env bash
TEXT_DEFAULT="\\033[0;39m"
TEXT_INFO="\\033[1;32m"
TEXT_ERROR="\\033[1;31m"
TEXT_YELLOW="\\033[1;33m"
echo -e "$TEXT_YELLOW""[ >>> PRE-COMMIT START ]""$TEXT_DEFAULT"
FILES_PATTERN='(\..+)?$'
@rorymcdaniel
rorymcdaniel / loop-multisite.sh
Created Dec 16, 2015
Bash script that will regenerate all images for all sites in a WordPress multisite network
View loop-multisite.sh
#!/bin/bash
for site in `wp site list --field=url`; do
wp media regenerate --yes --url=$site
done
~
@rorymcdaniel
rorymcdaniel / romsync.py
Last active Feb 7, 2016 — forked from brpowell/romsync.py
Dropbox rom syncing script for retropie console
View romsync.py
#!/usb/bin/env python
import os
import dropbox
import shutil
import zipfile
# Create a dropbox app and obtain App Key and Secret Key. Specify a folder
# Create a folder called romsync in your specified Dropbox app folder
# Store Dropbox App Key and Secret Key in system environment variables
View wpApiGetUsers.php
<?php
$wp = new GuzzleHttp\Client();
$request = $wp->get('http://www.example.com/wp-json/wp/v2/users');
$statusCode = $request->getStatusCode();
if($statusCode >= 200 && $statusCode < 300 ) {
$users = json_decode($request->getBody());
foreach($users as $user) {
//var_dump($user->id);
//var_dump($user->name);
//var_dump($user->slug);
@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()
@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 / 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 / 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 / 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;
You can’t perform that action at this time.