Find out what version of PHP is running
which php
This will output the path to the default PHP install which comes preinstalled by Mac OS X, by default
| #!/bin/bash | |
| # CHANGE THESE | |
| auth_email="[email protected]" | |
| auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings | |
| zone_name="example.com" | |
| record_name="www.example.com" | |
| # MAYBE CHANGE THESE | |
| ip=$(curl -s http://ipv4.icanhazip.com) |
| <?php | |
| // Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored) | |
| // http://youtu.be/dQw4w9WgXcQ | |
| // http://www.youtube.com/embed/dQw4w9WgXcQ | |
| // http://www.youtube.com/watch?v=dQw4w9WgXcQ | |
| // http://www.youtube.com/?v=dQw4w9WgXcQ | |
| // http://www.youtube.com/v/dQw4w9WgXcQ | |
| // http://www.youtube.com/e/dQw4w9WgXcQ | |
| // http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ |
The following shell transcript shows how to:
It is assumed that the pass package has been installed on both the first and second computers.
| <?php | |
| /** | |
| * Dirty, dirty Reddit bot: Decronym | |
| */ | |
| class Reddit { | |
| const USERNAME = 'Decronym'; | |
| const PASSWORD = '***'; | |
| const CLIENTID = '***'; | |
| const SECRET = '***'; |
| <?php | |
| require dirname(__FILE__).'/wp-blog-header.php'; | |
| $wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')"); | |
| $wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'"); | |
| $wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)"); | |
| $wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))"); | |
| $wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))"); | |
| $wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')"); |
| {{-- | |
| INSTRUCTIONS | |
| 1. On your local/build/deployment system: | |
| - Ensure Laravel Envoy is installed on your deployment box (local computer, build server etc - not your production server). | |
| (see https://laravel.com/docs/5.2/envoy) | |
| - Set up a certificate or ssh config such that you can ssh to your production server without prompt. | |
| - Update the @servers array below with your production ssh details or ssh config. | |
| - Update the $php variable to represent the php app server for your server. |
| <?php | |
| // Hook when a coupon is applied to a cart | |
| add_action( 'woocommerce_applied_coupon', 'mwd_get_applied_coupons' ); | |
| // Get the current applied coupon and compare it with other applied coupons | |
| function mwd_get_applied_coupons() { | |
| // Get the currently applied coupon's type using the $_POST global to retrieve the current coupon's code | |
| foreach ( WC()->cart->get_coupons() as $code => $coupon ) { | |
| if($coupon->code == $_POST['coupon_code']) { |
We are building a Node.js service which will need asynchronous support for tasks like sending emails. Here's our evaluation: