View rand.php
1 2 3 4 5 6 7 8 9 10
<?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 ) ]++;
View argtest.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/bash
# argtest.sh
#
# bash positional args and quoting
 
greenon='\033[0;92m';
coloroff='\033[0m'
 
###### #######
## ## ## ## ##
View gist:de6ac5f80e89297fcb8f
1
WP_CLI::run_command( array( 'search-replace', 'old', 'new' ), array( 'network' => true ) );
View content.txt
1 2 3 4 5 6 7 8 9 10
Lorem ipsum
 
[shortcode]
<ul>
<li>foo</li>
<li>bar</li>
</ul>
[/shortcode]
 
Lorem ipsum
View cli-media-fix.php
1 2 3 4 5 6 7 8 9 10
<?php
if ( ! defined( 'WP_CLI' ) ) return;
/**
* Media Fix
*/
class Media_Fix extends WP_CLI_Command {
/**
View db-config.php
1 2 3 4 5 6 7 8 9 10
<?php
/**
* HyperDB configuration file
*
* This file should be installed at ABSPATH/db-config.php
*
* $wpdb is an instance of the hyperdb class which extends the wpdb class.
*
* Fully documented config file:
* http://plugins.svn.wordpress.org/hyperdb/trunk/db-config.php
View media-fix.php
1 2 3 4 5 6 7 8 9 10
<?php
if ( ! defined( 'WP_CLI' ) ) return;
/**
* Media Fix
*/
class Media_Fix extends WP_CLI_Command {
/**
View getopt-example.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/bash
 
ARGS=$(getopt -o a:b -l "ay:,bee:,dry-run" -n "cli.sh" -- "$@");
eval set -- "$ARGS";
 
while (("$#")); do
case "$1" in
-a|--ay)
shift;
if [ -n "$1" ]; then
View robots-crawl-delay.php
1 2 3 4 5 6 7 8 9 10
<?php
/**
* Plugin Name: Robots Crawl Delay
*/
function prefix_robots_crawl_delay( $output, $public ) {
$output .= "Crawl-delay: 8\n";
return $output;
}
add_filter( 'robots_txt', 'prefix_robots_crawl_delay', 10, 2 );
Something went wrong with that request. Please try again.