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 | |
| /** | |
| * Exclude specific categories from being considered when selecting related products | |
| */ | |
| function my_exclude_related_terms( $terms ) { | |
| $exclude = array( 'First Category', 'second-category' ); | |
| foreach ( $terms as $i => $term ) { | |
| if ( in_array( $term->name, $exclude ) || in_array( $term->slug, $exclude ) ) { | |
| unset( $terms[ $i ] ); | |
| } |
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
| package isbn; | |
| import java.util.regex.Pattern; | |
| /** | |
| * ISBN class. | |
| */ | |
| public class Isbn { | |
| /** Number of digits in ISBN. */ | |
| public static final int LENGTH = 13; |
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
| import boto.vpc | |
| import time | |
| REGION_NAME = 'us-west-2' | |
| AMI_ID = 'ami-8e27adbe' # Amazon Linux AMI | |
| conn = boto.vpc.connect_to_region(REGION_NAME) | |
| # Create a VPC | |
| vpc = conn.create_vpc('10.0.0.0/16') |
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 parse_properties($txtProperties) { | |
| $result = array(); | |
| $lines = split("\n", $txtProperties); | |
| $key = ""; | |
| $isWaitingOtherLine = false; | |
| foreach ($lines as $i => $line) { | |
| if (empty($line) || (!$isWaitingOtherLine && strpos($line, "#") === 0)) | |
| continue; | |