Skip to content

Instantly share code, notes, and snippets.

@chrisvanpatten
chrisvanpatten / Composer.php
Last active February 3, 2021 19:05
Automatically symlink `object-cache.php` after installing `wp-redis`.
<?php
declare(strict_types=1);
namespace Namespace\Scripts;
use Composer\Installer\PackageEvent;
class Composer
{
/**
<?php
/*
* Plugin Name: Remove crazy counts slowing down my dashboard
* Plugin URI: https://pmgarman.me
* Description: Those comment counts are such a pain when you have a lot of comments
* Author: Patrick Garman
* Author URI: https://pmgarman.me
* Version: 1.0.0
* License: GPLv2
*/
# Apache .htaccess
RedirectMatch 301 ^/wp-content/uploads/(.*) http://livewebsite.com/wp-content/uploads/$1
# Nginx
location ~ ^/wp-content/uploads/(.*) {
rewrite ^/wp-content/uploads/(.*)$ http://livewebsite.com/wp-content/uploads/$1 redirect;
}
@bradp
bradp / setup.sh
Last active June 17, 2024 10:09
New Mac Setup Script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@markjaquith
markjaquith / nginx.conf
Last active December 25, 2022 15:55
My WordPress Nginx setup
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
}
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
}
# SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@nickdavis
nickdavis / gist:10525079
Created April 12, 2014 08:41
.htaccess 301 redirect local WordPress dev site images folder to live website images folder (to save fllling up local drive with 1000's of unnecessary images)
#301 Redirect Local Images to Live
RedirectMatch 301 ^/wp-content/uploads/(.*) http://livewebsite.com/wp-content/uploads/$1
@cam5
cam5 / single-product-reviews-excerpt.php
Created September 18, 2013 00:24
I used a few lines in the `single-product-reviews.php` woocommerce template to unhook jetpack on only product pages. Otherwise, it overrides the review form. Just calling the `Jetpack_Comments` class and removing those actions before the `comment_form()` was enough to selectively deactivate 'em. Note: your `single-product-reviews.php` might be i…
$jp = new Jetpack_Comments;
remove_action('comment_form_before', array($jp, 'comment_form_before'));
remove_action('comment_form_after', array($jp, 'comment_form_after'));`
comment_form( apply_filters( 'woocommerce_product_review_comment_form_args', $comment_form ) );
@ricardoalcocer
ricardoalcocer / script.php
Created April 19, 2013 21:17
PHP Script to migrate HubSpot blog to Wordpress
<?php
// php setup
error_reporting(E_ALL);
ini_set('display_errors', 'On');
date_default_timezone_set('America/Los_Angeles');
//
// grab input data
if (isset($_GET['max'])){
$max=$_GET['max'];