Skip to content

Instantly share code, notes, and snippets.

View plpepin's full-sized avatar

Pierre-Luc Pepin plpepin

  • White Octopus Web Development, LLC
  • Davie, FL
View GitHub Profile
// Where is the code going?
cssSel_Content = .somedialog .dialog__content;
$dlgContent = jQuery( cssSel_Content );
// Grab the content and paste it inside its destination
wordpress_site_url = 'http://www.somesite.com';
wordpress_page_slug = 'some-page-slug';
jQuery.get( wordpress_site_url + '/wp-json/wp/v2/pages', {
slug: wordpress_page_slug,
per_page: 1
Preload Bold version of font alternatives
- When template system uses a cache buster (say Shopify liquid)
<link href="{{ 'maisonneue-demi-webfont.woff2' | asset_url | split: "?" | first }}" type="font/woff2" as="font" rel="preload" />
- When the above doesnt work because the a javascript initiated the download even if the file is downloaded already
CSS:
.predload-maison-bold {
font-weight: bold;
@plpepin
plpepin / Shopify Random Category
Last active August 30, 2018 01:15
Shopify Random Category
{%- comment -%} Get the max amount of collections{%- endcomment -%}
{%- assign max_nb = collections.size -%}
{%- comment -%} Get a random seed based on seconds {%- endcomment -%}
{%- assign random_seed = "now" | date: "%S" %}
{%- if max_nb > 60 -%}
{%- comment -%} The max is MORE than 60 seconds. So we add the difference to the seed {%- endcomment -%}
{%- assign collection_size_difference = max_nb | minus: 60 -%}
{%- if random_seed > random_seed -%}