- install dnsmasq
$ brew install dnsmasq
...
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
- edit
/usr/local/etc/dnsmasq.conf
address=/local/127.0.0.1
# Redirect requests to /wp-content/uploads/* to production | |
set $production themotoringnetwork.com.au; | |
location @prod_uploads { | |
rewrite "^(.*)/wp-content/uploads/(.*)$" "https://$production/wp-content/uploads/$2" break; | |
} | |
# Rule for handling local requests for images | |
location ~ "^/wp-content/uploads/(.*)$" { | |
try_files $uri @prod_uploads; |
<?php | |
/* Thanks to http://steindom.com/articles/shortest-php-code-convert-csv-associative-array */ | |
ini_set('auto_detect_line_endings', TRUE); | |
$rows = array_map('str_getcsv', file('myfile.csv')); | |
$header = array_shift($rows); | |
$csv = array(); | |
foreach ($rows as $row) { |
#!/bin/sh | |
# | |
# This script uses rsstail to retrieve latests entries from Reddit Popular rss feed | |
# and process them through awk. Each update shows a timestamp separator. | |
# | |
# It will work with most RSS feeds out there. | |
# | |
if [ $# -eq 1 ]; then | |
subreddit="r/$1" |
<?php if( have_rows('billboard') ): ?> | |
<div class="billboard"> | |
<?php while( have_rows('billboard') ): the_row(); | |
$imageArray = get_sub_field('image'); | |
$imageURL = $imageArray['url']; | |
?> | |
<div class="slide-item" style="background-image: url('<?php echo $imageURL;?>');" > | |
<h1><?php the_sub_field('title'); ?></h1> | |
</div> |
<?php | |
//My ACF Fields for reference | |
//testimonials - field group | |
//testimonial - sub-field | |
//testimonial_header - sub-field | |
//First Repeater Row in Array | |
$rows = get_field( 'testimonials', 348 );// grab all rows from page ID |
(function($) { | |
/* | |
* new_map | |
* | |
* This function will render a Google Map onto the selected jQuery element | |
* | |
* @type function | |
* @date 8/11/2013 | |
* @since 4.3.0 |
read -r -p "Would you really like to reset your development database and pull the latest from production? [y/N] " response | |
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]] | |
then | |
wp @development db reset --yes | |
wp @production db export - > sql-dump-production.sql | |
wp @development db import sql-dump-production.sql | |
wp @development search-replace https://example.com https://example.dev | |
else | |
exit 0 | |
fi |
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' ); | |
/** | |
* custom_woocommerce_template_loop_add_to_cart | |
*/ | |
function custom_woocommerce_product_add_to_cart_text() { | |
global $product; | |
$product_type = $product->product_type; | |
switch ( $product_type ) { |
# font color : green | |
color='\e[0;32m' | |
# font color : white | |
NC='\e[0m' | |
getquote(){ | |
num_online_quotes=9999 | |
rand_online=$[ ( $RANDOM % $num_online_quotes ) + 1 ] | |
quote=$(wget -q -O - "http://www.quotationspage.com/quote/$rand_online.html" | |
$ brew install dnsmasq
...
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
/usr/local/etc/dnsmasq.conf
address=/local/127.0.0.1