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 | |
$one_off_filter = function( $text ) { | |
return str_replace( 'something', 'else', $text ); | |
} | |
add_filter( 'the_content', $one_off_filter ); | |
the_content(); | |
remove_filter( 'the_content', $one_off_filter ); |
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 | |
/** | |
* WP Redix Index | |
* | |
* Redis caching system for WordPress. Inspired by Jim Westergren. | |
* | |
* @author Jeedo Aquino | |
* @see http://www.jeedo.net/lightning-fast-wordpress-with-nginx-redis/ | |
* @see http://www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/ | |
*/ |
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
server { | |
listen 80; | |
server_name XX.XX.XX.XX; | |
root /var/www/html/default; | |
location / { | |
index index.php; | |
try_files $uri $uri/ /index.php?$args; | |
} |
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
server { | |
listen 80; | |
server_name XX.XX.XX.XX; | |
root /var/www/html/default; | |
location /index.php { | |
alias /var/www/html/default/wp-index-redis.php; | |
} | |
location / { |
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 | |
namespace Predis; | |
class PredisException extends \Exception { } | |
class ClientException extends PredisException { } // Client-side errors | |
class AbortedMultiExec extends PredisException { } // Aborted multi/exec | |
class ServerException extends PredisException { // Server-side errors | |
public function toResponseError() { | |
return new ResponseError($this->getMessage()); |
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 | |
$post_ids = array( 1, 2, 3, 4 ); | |
foreach ( $post_ids as $post_id ) { | |
$post = get_post( $post_id ); | |
if ( null === $post ) { | |
continue; | |
} |
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
( function( window, undefined ) { | |
var md, rd; | |
// Constants | |
var MU = 2.0; | |
G = 6.626 * Math.pow( 10, -8 ), | |
PI = 3.14159, | |
MS = 1.989 * Math.pow( 10, 33 ), | |
RS = 6.96 * Math.pow( 10, 10 ), | |
CSQ = Math.pow( 2.9979 * Math.pow( 10, 10 ), 2 ); |
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 | |
class Example { | |
public function __construct() { | |
$this->instantiate(); | |
} | |
public function instantiate() { | |
static $instance = null; | |
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 | |
/** | |
* This class contains two private methods we wish to test. | |
* In reality, it would also contain several public methods, | |
* but that's immaterial to our discussion. | |
* | |
* @package Tutorials | |
*/ | |
class ClassToTest { | |
/** |