Dirt Cheap Stage Race 2017

Thoughts on the races:

I did as expected on race #1 and race #2. I was comfortable with the distance and I knew I could run all the way even if it’s slower (because it’s trail instead of road).

I was so not prepared for the last race, however. My original goal was to run through the entire course. That quickly changed to “just don’t give up.” 1) not enough training to cover 11 mile distance in a trail or on a road, 2) not doing enough trail running period, 3) Didn’t break-in the new running shoes, 4) didn’t plan any rehydration or refueling during the race, 5) didn’t practice the race routes in advance, 6) not having any experience running long distance in 20 degree weather.

It was COLD!

Official Result:

Bib Number: 168

Race #1 Result

Distance: 3.11 miles
Total Time: 39:14.0
Place: 119 out of 203
Age Group (Female 40-49): 6 out of 32

Race #2 Result

Distance: 5.5 miles
Total Time: 1:00:30.0
Place: 140 out of 197
Age Group (Female 40-49): 5 out of 30

Race #3 Result

Distance: 11 miles
Total Time: 2:21:36
Place: 124 out of 220
Age Group (Female 40-49): unknown

Overall Race Series Result

Total Time: 4:01:27
Place: 108 out of 175
Age Group (Female 40-49): 5 out of 30

Next Goals:

I’m definitely doing this race again next year…and I’m going to run entire 11 miles.

Also I’d love to see myself being at top 100 overall.

I need to improve my running pace in general. I found that I’m pretty good at going UP the hill…but not so much going down. I think I’m really scared of falling (because it happens ALL THE TIME). I need to get over that fear.

MySQL queries cheatsheet for WordPress

Changing from http to https in wp_posts.post_content and wp_posts.guid

UPDATE wordpress_db.wp_posts
SET post_content = REPLACE(post_content, 'http://domain.com', 'https://domain.com')
WHERE post_content LIKE '%http://domain.com%';

UPDATE wordpress_db.wp_posts
SET guid = REPLACE(guid, 'http://domain.com', 'https://domain.com')
WHERE guid LIKE '%http://domain.com%';

Wineglass Half Marathon 2017

Official Result:

Bib Number: 4205
Total Time: 2:21:39.08
Place: 1739 (out of 2824)
Place Female Only: 1201 (out of 2128)
Place Female Age Group 40-44: 207 (out of 317)

Thoughts on the race:

I can’t believe I actually run ALL THE WAY. I’ve NEVER EVER run this far before EVER. So just for that, I’m feeling good.

Weatherwise….foggy and cold, really cold. I wish I had my gloves with me. My hands were numb during the entire race. I had a cotton long sleeve shirt, a t-shirt, then a windbreaker on top of those. with a cropped sweatpants. Never got warm enough to wanting to take a layer off….actually I wanted to put one more layer.

Next Goals:

I’d love to finish less than 2:10:00 next time. If I can take off the 10 lbs I gained this year, I think that’s doable. I wasn’t out of breath or completely exhausted at the end of the race. I think I paced myself a bit too slow (because I wasn’t sure if I can cover the distance).

Not sure if I want to sign up for this particular race next year:

  1. Pretty far from my house. I have to place my pups in the kennel overnight. I also have to secure a hotel room for a night for myself unless I’m willing to wake up and leave at 3am in the morning…which I’m not.
  2. Required shuttle ride from Corning to the start line is a nerve wrecking. Waiting to get on the bus at the pickup point was more than 30 minutes. Finding a parking lot to get to the pickup point was also difficult. You are constantly worried if you get to the start line on time. We barely made it even though we were at the shuttle pickup point well before the cut off time. Trying to use the bathroom before the race wasn’t smooth either.
  3. Finding a hotel room for next year is already almost impossible at this point…seriously.

Installing Let’s Encrypt on Ubuntu 16.04 with Apache server

sudo apt-get install python-letsencrypt-apache

Resource: How To Secure Apache with Let’s Encrypt on Ubuntu 16.04
Resource: How to install and use Let’s Encrypt on a Ubuntu Server for SSL security

WooCommerce 3.1.2: How to restore “add to cart” button in product category page

I noticed “add to cart” (or “select option” for variable products) buttons are no longer there with the most recent version of WooCommerce.
I checked content-product.php to see if the button was removed…it was not according to their template comment:

/**
 * The template for displaying product content within loops
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/content-product.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see     https://docs.woocommerce.com/document/template-structure/
 * @author  WooThemes
 * @package WooCommerce/Templates
 * @version 3.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

global $product;

// Ensure visibility
if ( empty( $product ) || ! $product->is_visible() ) {
	return;
}
?>
<li <?php post_class(); ?>>
	<?php
	/**
	 * woocommerce_before_shop_loop_item hook.
	 *
	 * @hooked woocommerce_template_loop_product_link_open - 10
	 */
	do_action( 'woocommerce_before_shop_loop_item' );

	/**
	 * woocommerce_before_shop_loop_item_title hook.
	 *
	 * @hooked woocommerce_show_product_loop_sale_flash - 10
	 * @hooked woocommerce_template_loop_product_thumbnail - 10
	 */
	do_action( 'woocommerce_before_shop_loop_item_title' );

	/**
	 * woocommerce_shop_loop_item_title hook.
	 *
	 * @hooked woocommerce_template_loop_product_title - 10
	 */
	do_action( 'woocommerce_shop_loop_item_title' );

	/**
	 * woocommerce_after_shop_loop_item_title hook.
	 *
	 * @hooked woocommerce_template_loop_rating - 5
	 * @hooked woocommerce_template_loop_price - 10
	 */
   
	do_action( 'woocommerce_after_shop_loop_item_title' );

	/**
	 * woocommerce_after_shop_loop_item hook.
	 *
	 * @hooked woocommerce_template_loop_product_link_close - 5
	 * @hooked woocommerce_template_loop_add_to_cart - 10
	 */
    
   	do_action( 'woocommerce_after_shop_loop_item' );
	?>
</li>

Regardless, the button is still not there so I added the button again in the current theme’s functions.php (since I wasn’t making any other overwrite):

//woocommerce - restore "add to cart" button in product category page
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 20 );

And voila, it’s back.

The same disappearance behavior was observed in multiple themes…so I’m suspecting something happened in WooCommerce plugin (as opposed to a theme-related bug).

Include CSS the right way in a WordPress’ child theme

We really should be using wp_enqueue_style functions to include your theme’s stylesheets rather than using @import statements. The enqueue functions allows us to specify dependencies in much better way.

//enqueue style for child theme
function  custom_child_enqueue_styles(){
	// enqueue parent styles
	wp_enqueue_style('parent-theme', get_template_directory_uri() . '/style.css' );
	// enqueue child styles - style.css
	wp_enqueue_style('parent-theme-child', get_stylesheet_directory_uri() .'/style.css', array('parent-theme'));
	// enqueue child styles - scss/child.css
	wp_enqueue_style('parent-theme-child-scss', get_stylesheet_directory_uri() .'/scss/child.css', array('parent-theme', 'parent-theme-child'));
}
add_action('wp_enqueue_scripts', 'custom_child_enqueue_styles');

Finger Lake Triathlon 2017 – Olympic Distance Result

Official Result:

Total Time: 3:34:25
Place: 116 (out of 139)
Place Female Only: 30 (out of 42)
Place Female Age Group 40-45: 4 (out of 6)
Swim: 39:26 (2:38 100s pace)
Bike: 1:43:15 (14.17 mile per hour)
Run: 1:05:48 (10:37 per mile)

Thoughts on the race:

I’m just happy that I finished the race….without resorting to walking. I’ve been slacking with training. 15 lbs more than last year’s race…and let me assure you, it’s not muscle weight gain.

I swam half breaststroke, half freestyle. My priority was conserving energy for later, and I think I made the right decision. Unlike last year, the water wasn’t shallow so we weren’t dolphin diving much.

Last week, when I did a dry run of the entire olympic course, I run out of fuel and had a energy crash. So I decided to refuel twice, one at the beginning of the bike route, and another at the halfway into the bike route. I went with Honey Stinger Waffles, and it worked well. Except that I should have opened the wrapper before getting on the bike. I almost lost balance trying to open that thing.

And the run, I knew I was going to be slower than last year…especially carrying extra 15 lbs & doubling the distance. I’m pretty happy that I was under 11 minutes per mile. And because I refueled properly, I had enough energy to complete the run without exhausting myself.

Next Goals:

Run – under 10 minutes per mile
Bike – over 15 miles per hour
Swim – 100% freestyle
Overall – less than 3:30:00 total time.

I already signed up with a group swimming lessons for the fall. Hopefully, I can finally swim faster with freestyle than breaststroke next year. I’ve been working on my arm during the summer. This fall I will be working on my legs, and the winter lessons will be putting the two together to get the form right.

Next race is Wineglass half marathon in Corning in about 4 weeks. My goal is to run daily, bike twice a week, and swim once a week. I’ll need to start counting calorie intakes to lose some weight so that it will be easy on my knees. I probably have to give up the daily Starbucks drink for a while too (maybe reduce it to every other day).

CLI command cheatsheet – Git

I still can’t memorize these:

## To stage your whole working tree:
git commit -a

## to force commit
git push origin master --force

##clone to a specific folder
git clone https://example.com/path/to/gitfile.git destination-folder-name

CSS Trick – anchor position adjustment

HTML

<ul>
  <li><a href="#link1"</li>
  <li><a href="#link2"</li>
</ul>
<a name="link1" class="anchor"></a>
<p>Some content goes here.</p>
<a name="link2" class="anchor"></a>
<p>Some content goes here.</p>

CSS

.anchor {/*anchor link*/
	display: block; 
	position: relative; 
	top: -50px; 
	visibility: hidden;
}

How to change thumbnail size for Divi’s gallery module

post_thumbnails_divi.php is where Elegant Themes‘ Divi specifies the custom image sizes:

add_theme_support( 'post-thumbnails' );

global $et_theme_image_sizes;

$et_theme_image_sizes = array(
	'400x250'  => 'et-pb-post-main-image',
	'1080x675' => 'et-pb-post-main-image-fullwidth',
	'400x284'   => 'et-pb-portfolio-image',
	'510x382'   => 'et-pb-portfolio-module-image',
	'1080x9999' => 'et-pb-portfolio-image-single',
	'400x516'   => 'et-pb-gallery-module-image-portrait',
	'2880x1800' => 'et-pb-post-main-image-fullwidth-large',
);

$et_theme_image_sizes = apply_filters( 'et_theme_image_sizes', $et_theme_image_sizes );
$crop = apply_filters( 'et_post_thumbnails_crop', true );

if ( is_array( $et_theme_image_sizes ) ){
	foreach ( $et_theme_image_sizes as $image_size_dimensions => $image_size_name ){
		$dimensions = explode( 'x', $image_size_dimensions );

		if ( in_array( $image_size_name, array( 'et-pb-portfolio-image-single' ) ) )
			$crop = false;

		add_image_size( $image_size_name, $dimensions[0], $dimensions[1], $crop );

		$crop = apply_filters( 'et_post_thumbnails_crop', true );
	}
}

I wanted to modify the “et-pb-gallery-module-image-portrait” thumbnail size to be 500×500. Since I was using a child theme, my thought was to copy the post_thumbnails_divi.php into the child theme and change the value there.

…Nope, that didn’t work.
Continue reading “How to change thumbnail size for Divi’s gallery module”