Skip to content

Instantly share code, notes, and snippets.

View mizner's full-sized avatar

Michael Mizner mizner

View GitHub Profile
@Veraxus
Veraxus / wp-aws-ses.php
Last active May 22, 2018 02:33
WordPress SMTP AWS SES Setup
<?php
/*
Plugin Name: SMTP Configuration
Plugin URI:
Description: Force WordPress to use SMTP settings for AWS SES.
Version: 1.0
Author: Matt van Andel
Author URI: http://mattvanandel.com
License: GPLv2 or later
*/
@tripflex
tripflex / functions.php
Last active March 19, 2025 11:59
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
<?php
/**
* Make sure the function does not exist before defining it
*/
if( ! function_exists( 'remove_class_filter' ) ){
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
@lukecav
lukecav / WP-CLI-Commands
Last active September 20, 2020 21:01
WP-CLI - Handy Commands
Search and replace
https://wp-cli.org/commands/search-replace/
wp search-replace
wp search-replace 'http://example.dev' 'http://example.com'
Optmize database
https://wp-cli.org/commands/db/optimize/
wp db optimize
Repair database
@mizner
mizner / docker-wordpress.sh
Created August 16, 2016 10:03 — forked from tatemz/docker-wordpress.sh
A quick way to get a WordPress installation up and running with Docker
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
my-wpdb:
image: mariadb
ports:
<?php
spl_autoload_register(function ($class) {
//change this to your root namespace
$prefix = 'vendor\\rootnamespace\\';
//make sure this is the directory with your classes
$base_dir = __DIR__ . '/classes/';
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
return;
}
@ravibhure
ravibhure / git_rebase.md
Last active March 5, 2026 12:07
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@seize-the-dave
seize-the-dave / configure-macos.sh
Last active July 9, 2020 11:58
Script to install everything onto a new Mac
# Install command line developer tools
xcode-select --install
# Install Brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Reset brew
brew update
brew upgrade brew-cask
brew cleanup
@ahmadawais
ahmadawais / upload-a-file.MD
Created June 18, 2017 11:07 — forked from websupporter/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle:

@beardedtim
beardedtim / index.js
Last active July 28, 2017 22:16
Creating mass dummy data in Stripe for testing
/*
We get the dummy tokens from
https://stripe.com/docs/testing#cards-responses
*/
const stripe = require('stripe')(process.env.STRIPE_KEY);
const faker = require('faker');
const createAmount = () => Math.floor(Math.random() * 2000) + 500
const makeCharge = ({ source }) => {
@kingkool68
kingkool68 / svg-functions.php
Created August 4, 2017 03:22
SVG helper functions for WordPress
<?php
// Throw this in your theme and include it in your functions.php file
/**
* Helper function for fetching SVG icons
*
* @param string $icon Name of the SVG file in the icons directory
* @return string Inline SVG markup
*/
function wp_svg_icon( $icon = '' ) {