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 | |
function get_permutations( array $values ) { | |
$n = count($values); | |
$rec = function ( array $values, &$ret, $n, array $cur = array() ) use ( &$rec ) { | |
if ( $n > 0 ) { | |
foreach ( $values as $v ) { | |
$newCur = $cur; |
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 | |
function eg_add_rewrite_rules() { | |
global $wp_rewrite; | |
$post_type = 'post'; | |
if ( ! is_object( $post_type ) ) { | |
$post_type = get_post_type_object( $post_type ); | |
} |
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
function __construct() { | |
add_action( 'admin_print_scripts-widgets.php', function(){ | |
if (is_admin()){ //test fails b/c the admin_print_scripts-widget.php is not aware that is_admin() is true... | |
wp_enqueue_style( 'spw-admin', plugins_url( 'css/' . 'spw-admin.min.css', dirname( __FILE__ ) ), false, 1 ); | |
wp_enqueue_script( 'spw-admin', plugins_url( 'javascripts/' . 'spw-admin.min.js', dirname( __FILE__ ) ), array( 'jquery' ), 1, true ); | |
} | |
} ); | |
} |
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
matthews-mbp-2:bin mat$ ./install-wp-tests.sh test test test localhost latest | |
+ install_wp | |
+ mkdir -p /tmp/wordpress/ | |
+ '[' latest == latest ']' | |
+ local ARCHIVE_NAME=latest | |
+ wget -nv -O /tmp/wordpress.tar.gz http://wordpress.org/latest.tar.gz | |
2014-02-06 18:04:20 URL:http://wordpress.org/latest.tar.gz [5869727/5869727] -> "/tmp/wordpress.tar.gz" [1] | |
+ tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C /tmp/wordpress/ | |
+ wget -nv -O /tmp/wordpress//wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php | |
2014-02-06 18:04:22 URL:https://raw.github.com/markoheijnen/wp-mysqli/master/db.php [10499/10499] -> "/tmp/wordpress//wp-content/db.php" [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
// theme code | |
$contestants = apply_filters('contestants', 'name'); | |
if ( is_array( $contestants ) ) { | |
foreach($contestants as $contestant){ | |
echo "hello " . $contestant . '<br>'; | |
} | |
} elseif ( is_string($contestants)){ |
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
$user = $this->factory->user->create_and_get( array( | |
'role' => 'administrator' | |
) ); | |
wp_set_current_user( $user->ID ); |
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 | |
if ( ! term_exists( 'free-flow', 'category' ) ) { | |
wp_insert_term( 'Free Flow', 'category', | |
array( | |
'description'=> 'Give extra left-right padding to the text block', | |
'slug' => 'free-flow', | |
) | |
); | |
} |
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
add_action( 'save_post', function(){ | |
wp_schedule_single_event( time(), 'action_to_run' ); | |
}); | |
add_action( 'action_to_run', 'function_to_run' ); | |
function function_to_run(){ | |
//asynchronous code to run! | |
} |
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
cat ~/.ssh/id_rsa.pub | ssh root@your.ip.address "cat >> ~/.ssh/authorized_keys" |
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 | |
add_action( 'add_meta_boxes', function() { | |
add_meta_box( 'asdf123_editors', 'Editors', function() { | |
wp_editor( 'Drag/Drop => True', 'asdf123_editor_1', array( | |
'drag_drop_upload' => true, | |
) ); |
OlderNewer