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 | |
/** | |
* Plugin Name: Custom CSS for wp-impress-js | |
*/ | |
add_action( 'impress_head', 'mask_custom_css_for_wp_impress_js' ); | |
function mask_custom_css_for_wp_impress_js() { | |
?> | |
<style> |
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 | |
// Example: | |
$data_from_api = LibraryOfCachableFunctions::get_some_data_from_api( $args ); | |
// LibraryOfCachableFunctions does not have a get_some_data_from_api() function. | |
// This causes __callStatic() to be called. __callStatic() takes care of caching. | |
// if the results are not available in the cache, it calls a function by adding an underscore to the name of the called function. | |
// the _get_some_data_from_api() function is used to obtain the results and store them in the cache. |
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
int cell_size = 4; | |
int canvas_size = cell_size * 200; | |
StringList coordinates_of_alive_cells; | |
void setup () { | |
size( canvas_size, canvas_size ); | |
// Initial pattern | |
coordinates_of_alive_cells = new StringList(); | |
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 countAdjacentPairs(search_string) { | |
var words_that_appeared_in_adjacent_pairs = []; | |
sets_of_two_adjacent_words_in( search_string ).forEach( function( two_adjacent_words ) { | |
var first_of_the_two_words = two_adjacent_words[ 0 ]; | |
if ( | |
two_adjacent_words.are_a_pair() | |
&& first_of_the_two_words.is_not_one_of( words_that_appeared_in_adjacent_pairs ) | |
) { | |
// which one reads more naturally? |
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 break_into_words( text ) { | |
return text.split( ' ' ).filter( function(word) { return word !== ''; } ); | |
} | |
function add( element, to_array ) { | |
to_array.push( element ); | |
} | |
function space_separated( array ) { | |
return array.join( ' ' ); |
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 | |
/** | |
* Plugin Name: My custom Gravity form submission processing plugin | |
*/ | |
// We will use photo contest entry submissions as the example | |
when_a_gravity_form_is_submitted( 'check_whether_it_is_a_contest_entry_submission' ); | |
when_a_contest_entry_is_submitted( 'do_some_custom_processing' ); |
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
when_the 'page_loads', -> | |
display_weather_analysis_map() | |
enable_changing_display_option_by_clicking_display_options() | |
enable_navigating_map_by_using_search() | |
display_weather_analysis_map = -> | |
when_the 'current_station_info_is_available', -> | |
show_map "analysis-map", false | |
show_what_station_is_being_shown() |
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 | |
/* | |
* This code implements a simple higher/lower guessing game. | |
* | |
* The computer picks a random number and the user guesses by way of an HTML form. | |
* | |
* The user is given hints if they guess incorrectly with the ability to try again. | |
* | |
* Upon winning the game the user can add their name to a session-based leaderboard. | |
*/ |
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 ( Yii::app()->user->hasFlash( 'changePassword' ) ): ?> | |
.flash-success | |
p style="color:red;" | |
<?php echo Yii::app()->user->getFlash( 'changePassword' );?> | |
<?php endif ?> |
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
def test_html_unescaped_php_tags | |
source = %q{ | |
a href="<?php echo $url ?>" | |
} | |
assert_html '<a href="<?php echo $url ?>"></a>', source | |
end |