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 naive(pattern, text): | |
occurrences = [] | |
for i in range(len(text) - len(pattern) + 1): | |
match = True | |
for k in range(len(pattern)): | |
if text[i+k] != pattern[k]: | |
match = False | |
break | |
if match: | |
occurrences.append(i) |
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 | |
// load the links & Slugs from the file they're stored in | |
$links = parse_ini_file('links.ini'); | |
// get the slug and remove any / characters | |
$slug = str_replace('/', '', $_SERVER['PATH_INFO']); | |
// check if the slug exists and if it corresponds to a link | |
if(isset($slug) && array_key_exists($slug, $links)){ |
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
<script type="text/javascript"> | |
jQuery(document).ready(function(){ | |
/*jQuery firing on add to cart button click*/ | |
jQuery('.single_add_to_cart_button').click(function(){ | |
/*Product meta data being sent; this is where you'd do your | |
document.getElementsByName or .getElementById*/ | |
var product-meta-data = 'product-meta-data'; | |
/*Ajax request URL being stored*/ | |
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>'; | |
jQuery.ajax({ |