This file contains hidden or 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 | |
| if ( !defined( 'WP_CLI' ) ) return; | |
| /** | |
| * Migrate meta values to terms | |
| * | |
| * @package wp-cli | |
| */ | |
| class Meta_To_Term_Migration extends WP_CLI_Command { |
This file contains hidden or 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 | |
| /* | |
| Plugin Name: Toggle Debug | |
| Description: Proof-of-concept for an admin-bar debug mode toggle. Needs some UX love. | |
| */ | |
| /* | |
| // In wp-config.php, wrap debug constants in a cookie conditional | |
| if ( isset( $_COOKIE['wp-debug'] ) && $_COOKIE['wp-debug'] == 'on' ) { | |
| define('WP_DEBUG', true); | |
| } |
This file contains hidden or 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
| # map block must be outside the server{} block | |
| map $host $productionurl { | |
| default mainsite.com; | |
| ## uncomment for multisite | |
| # subsite.dev subsite.com; | |
| # subsite2.dev subsite2.com; | |
| # subsite3.dev subsite3.com; | |
| } |
This file contains hidden or 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 | |
| /* | |
| // "K2 Tools" Module by JoomlaWorks for Joomla! 1.5.x - Version 2.1 | |
| // Copyright (c) 2006 - 2009 JoomlaWorks Ltd. All rights reserved. | |
| // Released under the GNU/GPL license: http://www.gnu.org/copyleft/gpl.html | |
| // More info at http://www.joomlaworks.gr and http://k2.joomlaworks.gr | |
| // Designed and developed by the JoomlaWorks team | |
| // *** Last update: September 9th, 2009 *** | |
| */ | |
| //*****/ |
This file contains hidden or 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
| # goes in my .bash_profile so I can quickly zip files/directories with encryption | |
| # (remove or replace `pbcopy/pbpaste` as needed for your system) | |
| # > pzip [file/directory] | |
| function pzip { | |
| head -n5 /dev/urandom | shasum | awk '{print $1}' | tr -d '\n' | pbcopy | |
| output=${1%/} #trim trailing slash | |
| output=${output%.*} #trim file extension | |
| echo -e "Making \033[32m$output.zip\033[0m from $1" | |
| zip -qrP "$(pbpaste)" $output $1; |
This file contains hidden or 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
| # generating a list of 50 post permalinks | |
| for pid in $(wp post list --field=ID --posts_per_page=50); do wp eval "echo get_the_permalink( $pid ).\"\n\"; "; done > url.txt | |
| # posts and pages | |
| for pid in $(wp post list --field=ID --posts_per_page=50 --post_type=post,page); do wp eval "echo get_the_permalink( $pid ).\"\n\"; "; done > url.txt | |
| # random sample | |
| for pid in $(wp post list --field=ID --posts_per_page=50 --post_type=post,page --orderby=rand); do wp eval "echo get_the_permalink( $pid ).\"\n\"; "; done > url.txt |
This file contains hidden or 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/bash | |
| vers=$(wp core version) | |
| for f in $(wp core verify-checksums --no-color 2>&1 >/dev/null | cut -d: -f3) | |
| do | |
| if [[ `curl -Is http://core.svn.wordpress.org/tags/$vers/$f | grep "200 OK"` ]] | |
| then | |
| echo "Fetching $f" | |
| curl -so $f http://core.svn.wordpress.org/tags/$vers/$f |
This file contains hidden or 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 | |
| function tmp_change_home_url( $homeurl ) { | |
| $old = 'example.com'; | |
| $new = 'newsite.com'; | |
| if ( strpos( $homeurl, $old ) !== false ) { | |
| $homeurl = str_replace( $old, $new, $homeurl ); | |
| } | |
| return $homeurl; |
This file contains hidden or 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
| # this goes in the http{} block | |
| # remove any $no_cache "sets" from individual site confs (e.g. ` set $no_cache 0;`) | |
| # 0 means we cache | |
| # any other value will negate it | |
| #check cookie for certain logged-in-type values, if found set 1 | |
| map $http_cookie $no_cookie_cache { | |
| default 0; | |
| "~comment_author_|wordpress_(?!test_cookie)|wp-postpass_" 1; |
This file contains hidden or 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 | |
| // testing how often a number in a given range will appear over many iterations | |
| $max = 10; // how big of a range? ( 1 thru $max ) | |
| $iterations = 100000; // how many iterations | |
| // set up an array for keeping tally | |
| $totals = array_fill( 1, $max, 0 ); | |
| for ( $i = 1; $i <= $iterations; $i++ ) { | |
| $totals[ rand( 1, $max ) ]++; |