functions – What’s the most efficient way to preload multiple font types using links and enqueue?

I added some code to my theme to preload my self-hosted enqueued fonts that are coming in via @font-face. I then added a filter to set the attributes. Seems to work and the pages load a bit faster too.

I’m not sure how to handle the various font types—eot ttf woff woff2—in the most efficient way so the browser doesn’t load them all for no reason, and to keep the code as minimal as possible. Not sure if there is a short-hand way for this or if everything needs to be enqueued and filtered one by one.

I also would like to know if I should be using wp_register_style and then use wp_enqueue_style for the preload, or if it’s fine to simply enqueue the fonts for the preload without registering.

Enqueued Fonts

wp_enqueue_style('font-1', get_stylesheet_directory_uri() . 'library/fonts/font-1.woff2', array(), null);
wp_enqueue_style('font-2', get_stylesheet_directory_uri() . 'library/fonts/font-2.woff2', array(), null);
wp_enqueue_style('font-3', get_stylesheet_directory_uri() . 'library/fonts/font-3.woff2', array(), null);

Filter

add_filter('style_loader_tag', 'my_font_style_filter', 10, 2);
function my_font_style_filter($html, $handle) {
    if ($handle === 'font-1' || $handle === 'font-2' || $handle === 'font-3') {
        return str_replace("rel='stylesheet'", "rel='preload' as='font' type='font/woff2' crossorigin='anonymous'", $html);
    }
    return $html;
}

magento2 – How to preload data into Magento 2 checkout billing address magento_ui form?

I have tweaked the checkout process of Magento 2.4.2 and moved the billing address into being the first step, all good and working.

I’ve managed to set the billingAddressFromData and the newCustomerBillingAddress when filling the form.

However, if I refresh the page, it will not populate the form although the data is there in the mage-cache-storage.

I have reverted the billing-address.js to the original form messing with the design but it still wouldn’t show the data from the local storage.

Any idea how could i debug this further or what might be the issues?

PS. shipping address form moved to the second step, however, it’s all working and showing all data.

partitions – TWRP: Failed to mount ‘/preload’ (Invalid argument)

With TWRP, on almost every operation I get

Failed to mount ‘/preload’ (Invalid argument)

My device currently can not boot, and this may have something to do with it, /preload is currently in /etc/fstab, I can see the entry here with

/dev/block/mmcblk0p16 /preload ext4 rw 0 0

When I try to mount it, I get

mount preload/
mount: mounting /dev/block/mmcblk0p16 on /preload failed: Invalid argument

Is there anyway to fix this problem?

From my recovery.log, I have

/preload | /dev/block/mmcblk0p16 | Size: 0MB Used: 0MB Free: 0MB Backup Size: 0MB
   Flags: Can_Be_Mounted Can_Be_Wiped IsPresent 
   Primary_Block_Device: /dev/block/mmcblk0p16
   Display_Name: preload
   Storage_Name: preload
   Backup_Path: /preload
   Backup_Name: preload
   Backup_Display_Name: preload
   Storage_Path: /preload
   Current_File_System: ext4
   Fstab_File_System: ext4
   Backup_Method: files

I’m trying to flash LineageOS, but I’m really just curious about resolving this error message.

magento2.3 – Magento 2 Fonts Preload head

I am adding the fonts as specified in magento 2.3 documentation however i am getting the error

Exception #0 (MagentoFrameworkConfigDomValidationException): Element 'font': This element is not expected. Expected is one of ( title, css, link, meta, script, remove, attribute ).

I am adding font as

<font src="https://magento.stackexchange.com/fonts/opensans/light/opensans-300.woff2"/>

https – Errors when checking eligibility for HSTS preload

I have this website set up:
http://website1.com/ – returns 301 Moved Permanently and redirects to http://www.website1.com/.

http://www.website1.com/ – returns 301 Moved Permanently and redirects to https://www.website2.com/.

https://www.website2.com/ – returns 200 OK and has this in the response:

strict-transport-security: max-age=31536000; includeSubDomains

I have this subdomain running a web app:
https://subdomain.website1.com/
This also has the following header in the response:

Strict-Transport-Security: max-age=31536000; includeSubDomains

I want to have preload functionality for all sub domains of website1.com/.
However, I get the following errors when checking eligibility:

Error: No HSTS header
Response error: No HSTS header is present on the response.

Error: HTTP redirects to www first
http://website1.com (HTTP) should immediately redirect to https://website1.com (HTTPS) before adding the www subdomain.
Right now, the first redirect is to http://www.website1.com/.
The extra redirect is required to ensure that any browser which supports HSTS will record the HSTS entry for the top level domain, not just the subdomain.

The first error is easy, I can just add the HSTS header.
But why does it matter that there’s a redirect?
All I want is for http://subdomain.website1.com/ to make an internal redirect to https://subdomain.website1.com/.

Can’t http://website1.com make an internal redirect to https://website1.com, regardless of the fact that it redirects to www.website1.com/?

android – Should I preload interstitial ads when my game starts?

I just recently added interstitial ads to my game. I loaded my interstitial ads when the main game actually starts so it wouldn’t take long to load after the user exits to the menu, but on profiling the memory usage, I realized that there are a lot of ad related allocations that are causing the gc to run wild. Is it that I should only request ads when I need them?

android – Should I preload interstitial apps when my game starts?

I just recently added interstitial ads to my game. I loaded my interstitial ads when the main game actually starts so it wouldn’t take long to load after the user exits to the menu, but on profiling the memory usage, I realized that there are a lot of ad related allocations that are causing the gc to run wild. Is it that I should only request ads when I need them?