This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// At the top of settings.php this snippit will short-cut any OPTIONS requests if you really don't want your CMS to be serving them. | |
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { | |
// At this point you may want to set more specific response headers, etc. | |
die('These are not the drones you seek.'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cleanup Accounts and Contacts | |
CREATE TEMPORARY TABLE account_cleanup_temp SELECT organization_uuid FROM _accounts_ WHERE organization_uuid IS NOT NULL GROUP BY organization_uuid HAVING COUNT(*) > 1; | |
DELETE a FROM _accounts_ INNER JOIN account_cleanup_temp t ON a.organization_uuid = t.organization_uuid; | |
DROP TABLE account_cleanup_temp; | |
CREATE TEMPORARY TABLE contact_cleanup_temp SELECT user_uuid FROM _contacts_ WHERE user_uuid IS NOT NULL GROUP BY user_uuid HAVING COUNT(*) > 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Engage LCache object caching system. | |
# We use a 'require()' here because in PHP 5.5+ changes to symlinks | |
# are not detected by the opcode cache, making it frustrating to deploy. | |
# | |
# More info: http://codinghobo.com/opcache-and-symlink-based-deployments/ | |
# | |
$lcache_path = dirname( realpath( __FILE__ ) ) . '/plugins/wp-lcache/object-cache.php'; | |
require( $lcache_path ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Spiderme - quick and clean benchmarking for website performance on Pantheon. | |
# | |
# This script uses wget to "spider" your website to provide a good set of data | |
# on site performance. It will automatically bypass Pantheon's edge cache, and | |
# skip images, javascript, css, etc. It will also only spider links that are | |
# under the multidev environment you are spidering. | |
# | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-Cookie: jetpackState[message]=authorized; path=/wp-admin; domain=dev-quicksilver-playground.pantheonsite.io | |
Set-Cookie: jetpackState[message]=authorized; path=/wp-admin; domain=dev-quicksilver-playground.pantheonsite.io | |
Set-Cookie: jetpackState[error]=module_activation_failed; path=/wp-admin; domain=dev-quicksilver-playground.pantheonsite.io | |
Set-Cookie: jetpackState[module]=after-the-deadline; path=/wp-admin; domain=dev-quicksilver-playground.pantheonsite.io | |
Set-Cookie: jetpackState[reactivated_modules]=after-the-deadline; path=/wp-admin; domain=dev-quicksilver-playground.pantheonsite.io | |
Set-Cookie: jetpackState[error]=module_activation_failed; path=/wp-admin; domain=dev-quicksilver-playground.pantheonsite.io | |
Set-Cookie: jetpackState[module]=contact-form; path=/wp-admin; domain=dev-quicksilver-playground.pantheonsite.io | |
Set-Cookie: jetpackState[reactivated_modules]=after-the-deadline%2Ccontact-form; path=/wp-admin; domain=dev-quicksilver-playground.pantheonsite.io | |
Set-Cookie: jetpackState[error]=module_ac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Here's how you can implement more nuanced logic for http auth. | |
# Note: this will not protect direct access to images, css, and js files. | |
# It will only block access to the site itself. | |
# It will also mean your site is not cached at the Pantheon edge at all. | |
# | |
# TODO: this will also block command-line access. To work around that | |
# we'd need to add an additional no-op check if the site is being accessed | |
# via Drush or WP-CLI. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ADDED AN "X-.*" TO THE END TO AVOID RE-SENDING CUSTOM HEADERS. | |
/** | |
* Remove headers we do not wish to pass on to the next request. | |
* | |
* @param $headers | |
* Headers to filter | |
* @return array | |
* Filtered headers | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Problem: there's code out there that relies on $_SERVER['SERVER_NAME'] and sometimes $_SERVER['SERVER_PORT'] | |
* to construct urls, either to "call itself" or to create urls that are passed to third parties and expect to | |
* be routed back. | |
* | |
* This doesn't work well on Pantheon because the environmental data will be for ephemeral container data. | |
* | |
* In general, you don't want your code to rely on this, but if you are using some piece of contrib you may |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Will pull images from a tag. | |
I'm using this to make a photobook of my brother in law's wedding, | |
but you might find it helpful for any number of other things. | |
""" | |
from instagram.client import InstagramAPI | |
from pprint import pprint | |
import urlparse | |
import urllib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Making use of: http://php.net/manual/en/function.phpversion.php | |
# | |
# The idea is you'd stick this in your core class at the top to prevent execution | |
# on out-dated runtime environments. | |
# | |
# You could use 50300 if you only care about 5.3, but it's EOL too, so... | |
if (!defined('PHP_VERSION_ID')) || PHP_VERSION_ID < 50400) { | |
# Inform users they need to upgrade their PHP version (or have their host do so) | |
# It'd be great if there was a common message or link to send users. |
NewerOlder