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
/** | |
* Callback function of the shortcode. | |
*/ | |
function ot_brand_products_cb($atts, $content){ | |
/** | |
* Setting variable value none. | |
*/ | |
$content = null; |
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
<!DOCTYPE html> | |
<!-- | |
HTML Examples | |
--> | |
<html> | |
<head> | |
<link rel="stylesheet" href="https://rawgit.com/Gorea235/4844ce9e603d34c82b2d1253b1a71799/raw/remote-image-slider.css"> | |
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" | |
crossorigin="anonymous"></script> |
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
/** | |
* Enqueue Google Analytics 4 script | |
* | |
*/ | |
/* Add Google Analytics 4 Site Tag as close to | |
the opening <head> tag as possible | |
=====================================================*/ | |
define("GA4","G-XXXXXX", false); // Replace GA4 ID |
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
/** | |
* Enqueue Google Tag Manager script | |
* | |
*/ | |
/* Add Google Tag Manager javascript code as close to | |
the opening <head> tag as possible | |
=====================================================*/ | |
define("GTM_TAG","GTM-XXXXXX", false); // Replace with GTM tracking ID |
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, { AxiosRequestConfig } from 'axios'; | |
import { useEffect, useState } from 'react'; | |
axios.defaults.baseURL = `${process.env.NEXT_PUBLIC_SITE_URL}/api/${process.env.NEXT_PUBLIC_API_VERSION}`; | |
export const useAxiosFetch = (params: AxiosRequestConfig<any>) => { | |
const [data, setData] = useState<any>(null); | |
const [error, setError] = useState<any>(null); | |
const [loading, setLoading] = useState<boolean>(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
import { useEffect, useState } from 'react'; | |
export default function useDebounce<T>(value: T, delay: number): T { | |
// State and setters for debounced value | |
const [debouncedValue, setDebouncedValue] = useState<T>(value); | |
useEffect( | |
() => { | |
// Update debounced value after delay | |
const handler = setTimeout(() => { |
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
enum Method { | |
GET = 'GET', | |
POST = 'POST', | |
PUT = 'PUT', | |
PATCH = 'PATCH', | |
DELETE = 'DELETE', | |
} | |
const useFetch = (endpoint: string, apiKey?: object) => { | |
const defaultHeader = { |
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 React, { useEffect } from 'react'; | |
interface IntersectionObserverProps { | |
root?: React.RefObject<Element | null>; | |
target: React.MutableRefObject<HTMLElement | null>; | |
onIntersect: () => void; | |
threshold?: number | number[]; | |
rootMargin?: string; | |
enabled?: boolean; | |
} |
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 { useEffect, useState } from 'react'; | |
const [isMetamaskInstalled, setIsMetamaskInstalled] = useState<boolean>(false); | |
// Check if Metamask wallet is installed and window.ethereum exists | |
useEffect(() => { | |
if (typeof (window as any)?.ethereum !== 'undefined' && (window as any)?.ethereum?.isMetaMask) { | |
setIsMetamaskInstalled(true); | |
} else { | |
setIsMetamaskInstalled(false); |
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 { ZodTypeAny } from 'zod'; | |
/* | |
* .safeParse | |
*/ | |
interface ZodResponseSuccess<T> { | |
success: true; | |
data: T; | |
} |
OlderNewer