Skip to content

Instantly share code, notes, and snippets.

View mariadanieldeepak's full-sized avatar

Maria Daniel Deepak mariadanieldeepak

View GitHub Profile
@mariadanieldeepak
mariadanieldeepak / rothys-thank-you-page-gtm-variables.js
Last active December 7, 2017 11:15
Use this script on the Thank You Page in Shopify to send the values to GTM
<!-- Start: Send variables to GTM -->
<script type="text/javascript">
{% if checkout.order_id or checkout.id %}
var productId = "",
isInsolesOnlyOrder = "true";
{% for line_item in checkout.line_items %}
{% if line_item.product.type != 'Insole' %}
isInsolesOnlyOrder = "false";
{% endif %}
productId += "{{ line_item.product.id }}";
@mariadanieldeepak
mariadanieldeepak / nginx-version
Last active March 23, 2018 19:33
List the nGinx version
daniel@myserver:~$ nginx -v
nginx version: nginx/1.10.3 (Ubuntu)
location ~ \.php$ {
// Include the fastcgi-php.conf file.
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
// Checking NGINX config file syntax
sudo nginx -t
// Restart NGINX server
sudo service nginx restart
@mariadanieldeepak
mariadanieldeepak / functions.php
Created June 30, 2018 08:48
Excludes Post IDs from Jetpack news sitemap
/**
* Excludes Post ID from Jetpack's news sitemap.
*
* @param bool $skip
* @param WP_Post $post
*
* @return bool
*/
function jpc_exclude_post_from_news_sitemap( $skip, $post ) {
if ( ! $post instanceof WP_Post ) {
@mariadanieldeepak
mariadanieldeepak / install-git.sh
Created August 31, 2018 14:01
Install Git in Linux
# Updates the packages list
sudo apt update
# Fetches the newwer versions of packages existing on the machine
sudo apt upgrade
# Install Git
sudo apt install git
<?php
// @see https://developer.wordpress.org/reference/functions/remove_action/
remove_action( string $tag, callable $function_to_remove, int $priority = 10 );
<?php
/**
* Breadcrumbs.
*
* @see woocommerce_breadcrumb()
*/
add_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
<?php
// To remove a hook, the $function_to_remove and $priority arguments must match with the hook when added.
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
@mariadanieldeepak
mariadanieldeepak / downgrade-node.sh
Created July 6, 2019 01:18
Downgrade Node in Mac OS using Homebrew without messing dependencies
# Find existing version
node --version
# Search available Node versions.
brew search node
# I neeeded a version between > 10.0 < 11. So I chose node@10.
brew install node@10
# You can install multiple versions, but you cannot have them available all at once.