Skip to content

Instantly share code, notes, and snippets.

View haroldao's full-sized avatar
🎯
Design + Dev

Harold AO haroldao

🎯
Design + Dev
View GitHub Profile
@dcchambers
dcchambers / mac-fixes.md
Last active September 4, 2024 17:57
Improve your MacOS Experience

Fixes for Various Mac Issues

A couple of things that may improve your experience using MacOS.

Many of these settings can be configured via the command line (and thus, scripted) using the MacOS defaults tool.

defaults help
defaults read   # list all defaults
defaults write ...
@khooz
khooz / js-only-age-restriction.js
Created September 29, 2021 08:52
Simple age restriction guard that only relies on js-cookie.
// Make sure js-cookies are loaded before this code
function verifyAge(gaurdingPage = "./age-verification.html") {
if (!Cookies.get("age-verification"))
{
Cookies.set("intended", window.location.href);
window.location.replace(gaurdingPage);
}
}
function checkAge(homePage = "./index.html", awayPage = "https://www.google.com/?q=") {
@atikju
atikju / related-articles.liquid
Created February 25, 2021 11:24
Show related articles based on article tags - Shopify
@pablogiralt
pablogiralt / shopify-brooklyn-theme-size-guide.md
Last active February 19, 2021 17:44
Add a size guide to Shopify Brooklyn Theme

Add Size Guide to Shopify Brooklyn Theme

This is what you get:

1- A link to below the variant selector which will open the size guide:

Shopify Brooklyn Theme Size Guide

2- The size selector modal:

@adamwooding
adamwooding / product-template-enquiry.liquid
Created November 6, 2020 22:18
Shopify Minimal Theme - sections template with no prices and enquiry form
<div itemscope itemtype="http://schema.org/Product" id="ProductSection" data-section-id="{{ section.id }}" data-section-type="product-template" data-image-zoom-type="{{ section.settings.product_image_zoom_type }}" data-show-extra-tab="{{ section.settings.show_extra_tab }}" data-extra-tab-content="{{ section.settings.extra_tab_content }}" data-enable-history-state="true">
{% case section.settings.add_to_cart_width %}
{% when 'small' %}
{%- assign btn_class = 'btn--wide' -%}
{%- assign productform_class = 'product-form--wide' -%}
{% when 'medium' %}
{%- assign btn_class = 'btn--wide' -%}
{%- assign productform_class = 'product-form--wide' -%}
{% when 'large' %}
@joePichardo
joePichardo / shopify-use-case-option-selection.html
Created September 28, 2020 14:27
Shopify option_selection.js usage
{{ 'option_selection.js' | shopify_asset_url | script_tag }}
<script>
// <![CDATA[
var selectCallback = function(variant, selector) {
if (variant) {
if (variant.available) {
// Selected a valid variant that is available.
$('#add-to-cart-button').removeClass('disabled').removeAttr('disabled').html('Add to Cart');
} else {
import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div
@hobo71
hobo71 / floating-animation-css.markdown
Created July 30, 2020 01:35
Floating Animation - CSS
@rleaf
rleaf / background-noise-canvas.markdown
Created February 8, 2020 05:09
Background Noise - Canvas
@akella
akella / setup.md
Last active December 26, 2025 06:19
My Setup