Skip to content

Instantly share code, notes, and snippets.

@blueprintmrk
blueprintmrk / product-json-ld.liquid
Created September 3, 2020 20:36 — forked from svaustin66/product-json-ld.liquid
Example of Structured Data for Shopify Product
{% assign current_variant = product.selected_or_first_available_variant %}
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"@id": "{{ shop.url | append: '/products/' | append: product.handle }}",
"url": "{{ shop.url | append: '/products/' | append: product.handle }}",
"name": "{{ product.title }}",
"image": "{{ product.featured_image.src | img_url: 'master' }}",
@blueprintmrk
blueprintmrk / twitter-cards.liquid
Created June 9, 2020 15:40 — forked from kitop/twitter-cards.liquid
Twitter Cards Snippet for Shopify Stores
{% comment %}
This is for widgets that share content on Twitter.
Twitter developer info: https://dev.twitter.com/docs/cards
Brought to you by Viralica http://viralica.com
{% endcomment %}
{% if template contains 'product' %}
<meta name="twitter:card" content="product">
<meta name="twitter:title" content="{{ product.title }}" />
<meta name="twitter:description" content="{{ product.description | strip_html | strip_newlines | truncatewords: 160, '' | escape }}" />
@blueprintmrk
blueprintmrk / twitter-cards.liquid
Created June 9, 2020 15:40 — forked from chrisjhoughton/twitter-cards.liquid
Twitter Card meta tags for Shopify. Add this as a snippet called "twitter-cards.liquid" in your theme, and then add {% include 'twitter-cards' %} to your theme.liquid file.
{% comment %}
This snippet renders meta data needed to create a Twitter card
for products and articles.
IMPORTANT: change @your_twitter_username with your actual twitter username!
Your cards must be approved by Twitter to be activated
- https://dev.twitter.com/docs/cards/validation/validator
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@blueprintmrk
blueprintmrk / yoast-homepage
Created March 25, 2020 00:16 — forked from patrickcoombe/yoast-homepage
Yoast Homepage
<script type = 'application/ld+json' class = 'yoast-schema-graph yoast-schema-graph--main'> {
"@context": "https://schema.org",
"@graph": [{
"@type": "Organization",
"@id": "https://yoast.com/#organization",
"name": "Yoast",
"url": "https://yoast.com/",
"sameAs": ["https://www.facebook.com/yoast", "https://www.instagram.com/yoast/", "https://www.linkedin.com/company/1414157/", "https://www.youtube.com/yoast", "https://www.pinterest.com/yoast/", "https://en.wikipedia.org/wiki/Yoast", "https://twitter.com/yoast"],
"logo": {
"@type": "ImageObject",
@blueprintmrk
blueprintmrk / woocommerce-optimize-scripts.php
Created March 18, 2020 18:47 — forked from DevinWalker/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@blueprintmrk
blueprintmrk / decode_unicode_google_maps_api.php
Created February 25, 2020 23:03 — forked from dertajora/decode_unicode_google_maps_api.php
Decode Encoded Unicode string (field html-instruction) on Google Maps API response
<?php
// Lets say , we want to send a direction request with guidance to Google Maps API using link below.
// https://maps.googleapis.com/maps/api/directions/json?origin=-6.190109,%20106.798565&destination=-6.177596,%20106.792611&key=USEYOUR_KEY
// some of request, especially in field html-instruction would return unicode html text like this one ('Head \u003cb\u003ewest\u003c/b\u003e').
// for some reason, I just want to use the text provided there ('Head west').
// after some googling and asking, here is the best code I have (right now)
# example response
//Type A : There are 2 sentence in one single direction response
@blueprintmrk
blueprintmrk / nginx-rewrite.conf
Created December 13, 2019 07:10 — forked from seafarer/nginx-rewrite.conf
301 redirect .html to non .html for nginx
rewrite ^(/.*)\.html(\?.*)?$ $1$2 permanent;
rewrite ^/(.*)/$ /$1 permanent;
try_files $uri/index.html $uri.html $uri/ $uri =404;
@blueprintmrk
blueprintmrk / error.js
Created August 13, 2019 01:57 — forked from davinkevin/error.js
Error generated by vget parsing function
This file has been truncated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