Skip to content

Instantly share code, notes, and snippets.

@NigelDorning
NigelDorning / mini-cart.md
Created March 5, 2023 18:53
Mini Cart example with Shopify

HTML

<button class="mini-cart__trigger">
    <img src="{{ 'icon-cart.svg' | asset_url }}" alt="Cart icon">
</button>

<div class="header__mobile-menu header__mobile-menu--hidden">
    <ul>
        {% for link in section.settings.main_menu.links %}
            <li><a href="{{ link.url }}">{{ link.title }}</a></li>
@NigelDorning
NigelDorning / main-product.liquid
Created December 4, 2022 13:11
The main product section for Shopify theme
<div class="container bg-white shadow-sm">
<div class="row gx-5 p-5">
<div class="col-6 main-product__image">
<img src="{{ product.featured_image | image_url: width: 600 }}" alt="{{ product.featured_image.alt }}">
</div>
<div class="col-6 main-product__form">
<h1>{{ product.title }}</h1>
<div class="mt-3">{{ product.description }}</div>
@NigelDorning
NigelDorning / infinite_pagination_with_livewire.php
Created May 11, 2022 12:52
Infinite pagination with Laravel Livewire
<!-- The Livewire Component -->
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Http;
class Posts extends Component
{
@NigelDorning
NigelDorning / calculate_date_excluding_weekend_and_bank_holidays.php
Last active April 29, 2022 19:32
Calculates the date when adding days excluding weekends and bank holidays in England and Wales
<?php
/**
* Checks to see if a given date is a bank holiday in the UK
*
* 1. Set the current year
* 2. Get the bank holidays in the UK
* 3. Parse out the bank holidays in the UK that are within the current year
* 4. Check to see if the if $check_date is within the current years bank holidays
* 4.1 Return true if it is