Skip to content

Instantly share code, notes, and snippets.

Avatar
👑
Getting it done

Helen Hou-Sandi helen

👑
Getting it done
View GitHub Profile
@rmccue
rmccue / gist:ec6a7d79349ea7e9b206
Last active Mar 28, 2017
WordPress test server - front controller for testing WP. *****NEVER USE THIS ON PRODUCTION******
View gist:ec6a7d79349ea7e9b206
<?php
/**
* WordPress Test Server
*
* This serves up a full WordPress site via the PHP test server (`php -S`), and
* is intended purely for serving WP for UI testing. Please do not ever use this
* in production.
*/
// Path to WP install
@kurtpayne
kurtpayne / rarst.php
Created Dec 3, 2013
Super subtle troll
View rarst.php
<?php
/**
* Plugin Name: Rarst's favorite plugin
* Description: SHUT UP
* Version: INF
* Author: The unholy army of trolls
* License: GPLv2 or MIT (they're equivalent, right?)
*/
add_action( 'all', function() {
global $wp_filter;
@markjaquith
markjaquith / gist:6225805
Last active May 2, 2021
WordPress multi-tenant directory structure sharing core files for opcode awesomeness, fast deployments, and low disk usage. With inspiration from @weskoop. "=>" indicates a symlink.
View gist:6225805
sites
|__ ms.dev
| |__ content
| |__ index.php
| |__ wp => ../../wordpress/stable
| |__ wp-config.php
|__ one.dev
| |__ content
| |__ index.php
| |__ wp => ../../wordpress/stable
@jeremyfelt
jeremyfelt / proxy-production.conf
Last active May 14, 2019
Nginx configuration to proxy 404 files locally to a production domain
View proxy-production.conf
# Adjust this to include any other necessary files.
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
try_files $uri $uri/ @production;
}
location @production {
resolver 1.1.1.1;
proxy_pass http://{replace-with.domain.com}/$uri;
@thomasgriffin
thomasgriffin / gist:4953041
Created Feb 14, 2013
My gift to you this Valentine's Day. Rendering custom attachment fields in the new media manager via Backbone.
View gist:4953041
/**
* The code below renders additional custom attachment fields into the
* new media manager.
*
* I am assuming you are using your own custom media modal frame. By
* extending the default Attachment.Details subview, we can append our
* custom fields to the default fields listed.
*
* In the initialize function, we ensure that our changes are always up
* to date by "listening" to our model's change event and updating the
@tommcfarlin
tommcfarlin / meta-data-serialization.php
Last active Jun 6, 2020
An example function used to demonstrate how meta data is typically saved in a WordPress theme or plugin. The gist is made public so that developers can contribute to the standard security boilerplate functionality in order to simplify, reduce, and improve our serialization functions.
View meta-data-serialization.php
<?php
/**
* An example function used to demonstrate how to use the `user_can_save` function
* that provides boilerplate security checks when saving custom post meta data.
*
* The ultimate goal is provide a simple helper function to be used in themes and
* plugins without the need to use a set of complex conditionals and constants.
*
* Instead, the aim is to have a simplified function that's easy to read and that uses
* WordPress APIs.
@koop
koop / gallery.js
Created Dec 3, 2012
Query all attachments uploaded to a post.
View gallery.js
@markjaquith
markjaquith / plugin-deploy.sh
Created Nov 16, 2012 — forked from scribu/plugin-deploy.sh
Plugin deploy script
View plugin-deploy.sh
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/svn/wp-plugins/$DIR_NAME/$BRANCH
@nacin
nacin / Modific.sublime-settings.js
Created Sep 25, 2012
My config for Modific. Disables --internal-diff (didn't work on Mac OSX 10.8 with svn 1.6.18 client). Reprograms a few key bindings I'll actually use.
View Modific.sublime-settings.js
// Modific default settings
{
// Name of a region icon
// Valid icon names are dot, circle, bookmark and cross
"region_icon": "circle",
// You can use your commands instead of plain "git" or "svn"
// e.g. "/usr/bin/git" or "C:\bin\git.exe"
"vcs": [
["svn", "/usr/bin/svn"],
@evansolomon
evansolomon / gist:3568555
Created Sep 1, 2012
Bash helpers for navigating WordPress code
View gist:3568555
# Alias ST2's command line tool for a shorter (easier-to-remember) name
alias st="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"
# Search for an open Sublime Text to a function definition
function fx() {
ack "function &?$1\(" | awk {'print $1'} | sed 's/:$//g' | xargs st
}
# Example usage from the root of a WordPress repository