Skip to content

Instantly share code, notes, and snippets.

View marioloncarek's full-sized avatar

Mario Loncarek marioloncarek

View GitHub Profile
@salexzee
salexzee / predictive-search.scss
Created June 6, 2021 23:09
SCSS from my predictive search YouTube tutorial video.
.top-bar__search {
position: relative;
}
.predictive-search {
background-color: #ffffff;
border: 1px solid #ababab;
border-radius: 2px;
left: 0;
opacity: 0;
@salexzee
salexzee / predictive-search.js
Created June 6, 2021 23:05
JavaScript from my predictive search YouTube tutorial video.
import PredictiveSearch from "@shopify/theme-predictive-search";
const elements = {};
const clearParent = (parent) => {
while (parent.firstChild) {
parent.removeChild(parent.lastChild);
}
};
@sindresorhus
sindresorhus / esm-package.md
Last active October 14, 2025 20:49
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@atikju
atikju / related-articles.liquid
Created February 25, 2021 11:24
Show related articles based on article tags - Shopify
@mpdevcl
mpdevcl / woocommerce_events.md
Created August 11, 2020 17:43
WooCommerce JS Events

WooCommerce JS Events

Source

Checkout

$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
$( document.body ).trigger( 'checkout_error' );
@bagerathan
bagerathan / woo-events.js
Last active September 30, 2025 10:44
[Woocommerce Javascript events] #woo
//Woocommerce Checkout JS events
$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
$( document.body ).trigger( 'checkout_error' );
//Woocommerce cart page JS events
$( document.body ).trigger( 'wc_cart_emptied' );
$( document.body ).trigger( 'update_checkout' );
@Robert-96
Robert-96 / README.md
Last active October 25, 2024 14:00
Get URL Parameters with JavaScript

Get URL Parameters with JavaScript

URL Parameters (Query Parameters) are a set o key value pars attached to the end of a url. They are used to send small amounts of data from page to page, or from client to server via a URL.

TL;DR

const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
@marcelo-ribeiro
marcelo-ribeiro / how-to-detect-a-click-outside-of-an-element-with-vanilla-javascript.markdown
Last active March 14, 2025 07:56
How to detect a click outside of an element with vanilla JavaScript

How to detect a click outside of an element with vanilla JavaScript

A simple way to detect a click outside of an element with vanilla JavaScript

A Pen by Marcelo Ribeiro on CodePen.

License.

@RDoney
RDoney / free-shipping.html
Last active February 5, 2025 09:27
Shopify free shipping progress calculator
<!-- Free shipping progress markup -->
<div class="cart-shipping__wrapper">
<p class="cart-shipping__numOuter">You're $<span class="cart-shipping__num"></span> away from free shipping!</p>
<p class="cart-shipping__success">You're eligible for Free Shipping!</p>
<div class="cart-shippingThreshold__bar">
<span class="cart-shippingThreshold__progress"></span>
</div>
</div>
<style>
@callaginn
callaginn / ajax-contact-form.js
Last active January 30, 2025 21:26
Shopify Ajax Contact Form
// Before implementing this, you'll need to contact Shopify support and ask them to turn off Google's ReCaptcha
// for your Shopify store's contact forms. Otherwise, it will redirect to the captcha's verification page.
// Retrieves input data from a form and returns it as a JSON object:
function formToJSON(elements) {
return [].reduce.call(elements, function (data, element) {
data[element.name] = element.value;
return data;
}, {});
}