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”

Musselman Weekend 2017 – MiniMusselman Result

Official Result:

Total Time: 2:02:52
Swim: 18:38
Bike: 1:03:24
Run: 32:41
Overall Place: 485/612
Female Place: 222/317
Age Group: 31/42

Thoughts:

Not too happy about the result: 1) 10 lbs heavier than last year, 2) bottom 1/4 on average compared to right about 1/2 last year 3) has been lazy and not training enough
On the positive side, I did swim in freestyle most of the time (I’d say about 90 %), and I did run all the way, no walking.
Next race is Olympic distance at Finger Lake in Sept…I need to get serious about training…and cut out cheese, bread, and wine.

Rochester Duathlon 2017 – Sprint Distance Result

Official Result:

1:44:23 for 2.5K run + 14 miles bike + 5K run

We didn’t have a tracker on this event, so pretty much the total time is the only data I got. No each segment data or transition time. Also due to the weather the bike route got changed (distance changed).

#4 of 7 (right in the middle) for my age group (female only)
#11 of 20 (again right in the middle) for all female
#32 of 43 for all participant

Thoughts:

I think I did good considering…I run all the way (no walk) and I biked faster than my commute mode most of the time.

Need to cut out binge eating before the race…that is don’t eat 4.5 donuts 2 days before the race thinking that’s the only unhealthy food you are gonna eat and you can surely burn that off. Then a day before the race you end up eating a BOX of ice cream sandwiches ( = 12 sandwiches) because…I don’t know because there is a box of them in the freezer. Then you realize the food at the race looks awesome and you can’t stop yourself after the race….because you’re hungry.

I think I gained 5 pounds by doing the race.