This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function splitUrlParameters( url : string ) { | |
const params = new URLSearchParams(url); | |
const paramObject = {} as Object; | |
for (const [key, value] of params.entries()) { | |
if (paramObject[key]) { | |
if (Array.isArray(paramObject[key])) { | |
paramObject[key].push(value); | |
} else { | |
paramObject[key] = [paramObject[key], value]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#run via: $ python3 webp.py | |
import os | |
# Present working directory | |
directory = "." | |
# Loop through each file | |
for file in os.listdir(directory): | |
if os.path.isfile(os.path.join(directory, file)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# place this file in your images dir, run `bash images.sh` | |
# this present working dir | |
directory="." | |
# Loop through each file | |
for file in "$directory"/*; do | |
if [ -f "$file" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import legacy from '@vitejs/plugin-legacy' | |
import ViteRestart from 'vite-plugin-restart'; | |
import 'dotenv/config' | |
import tailwindConfig from './tailwind.config'; | |
// https://vitejs.dev/config/ | |
export default ({ command }) => ({ | |
base: command === 'serve' ? '' : '/dist/', | |
build: { | |
manifest: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function vite_scripts() { | |
// wp-config needs: define( 'FRONTEND_DEV_MODE' , true ); added | |
if ( FRONTEND_DEV_MODE ) { | |
echo '<!-- vite time --> | |
<script type="module" src="https://localhost:3000/@vite/client"></script> | |
<script type="module" src="https://localhost:3000/src/js/app.ts"></script> | |
' ; | |
} else { | |
echo ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// component: dropdown | |
function filter_dropdown( $label, $type , $tax ) { ?> | |
<div class="relative w-full md:w-auto x-cloak" id="filter_<?php echo $type ;?>" x-data="{ menuListOpen : false }" > | |
<button | |
@click.away="menuListOpen = false" | |
@click="menuListOpen = ! menuListOpen " | |
:class="{ '' : menuListOpen } " | |
class="uppercase cursor-pointer border dropdown-button flex flex-row items-center justify-between self-end mr-0 ml-auto px-4 border-solid border-current h-[42px] w-full md:w-[216px]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Alpine from 'alpinejs' | |
export default Alpine.store('icons', { | |
close: `<svg width="42" height="36" viewBox="0 0 42 36" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
<line x1="10.6464" y1="27.8597" x2="31.8596" y2="6.6465" stroke="currentColor"/> | |
<line x1="10.7471" y1="7.03982" x2="31.9603" y2="28.253" stroke="currentColor"/> | |
</svg>`, | |
open: ` | |
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios' | |
import { useGlobalStore } from '@/stores/global' | |
export async function getChildProductDataFromApi(child: { child_article_nbr: any }) { | |
const options = { | |
decompress: false | |
} | |
const url = `/apis/ui/products/${child.child_article_nbr}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro imageSourceTags( image ) %} | |
{% if image.extension is defined %} | |
{% if image | length >= 1 and image.extension != 'svg' %} | |
{% set formats = ['webp', 'jpg'] %} | |
{% for format in formats %} | |
{% set srcset = image.getSrcset([185, 576, 768, 960, 1454, 1920, 2560], { format: format }) %} | |
<source srcset="{{ srcset }}" type="image/{{ format }}" sizes="100vw"> | |
{% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function filteredProducts() { | |
// get the total list of products | |
let filteredProducts = useGlobalStore().products; | |
// set criteria - examples var names here. | |
const stamina = useGlobalStore().decisions.stamina | |
const type = useGlobalStore().decisions.type | |
const group = useGlobalStore().decisions.group |
NewerOlder