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, useCallback, useRef, useState, useMemo } from "react"; | |
| import { Upload } from "tus-js-client"; | |
| enum UploadStatus { | |
| IDLE = "idle", | |
| UPLOADING = "uploading", | |
| PAUSED = "paused", | |
| RESUMED = "resumed", | |
| COMPLETED = "completed", | |
| ERROR = "error", |
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
| class HttpResponseError extends Error { | |
| constructor (message, response) { | |
| super(message); | |
| this.response = response | |
| } | |
| } | |
| async function simpleFetch( | |
| url /* @type( string | RequestInfo | URL ) */, | |
| options /* @type( Omit<RequestInit, "signal"> && { controller: AbortController } ) */ |
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, useRef } from "react"; | |
| import { useIsDOMElementVisibleOnScreen } from "react-busser"; | |
| import type { InfiniteQueryResult, InfiniteQueryKey, InfiniteQueryFunction, InfiniteQueryOptions } from "react-query"; | |
| import { useInfiniteQuery } from "react-query"; | |
| export type InfiniteScrollQueryOptions<TK, TR, TMV, TE> = { | |
| queryKey: InfiniteQueryKey<TK>; | |
| queryFn?: InfiniteQueryFunction<TR, TK, TMV>; | |
| config?: InfiniteQueryOptions<TR, TMV, TE>; | |
| }; |
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
| "use client" | |
| import { useEffect } from "react"; | |
| import TagManager from "react-gtm-module"; | |
| export default function GoogleTagManager () { | |
| useEffect(() => { | |
| const gtmId = process.env.NEXT_PUBLIC_GTM_ID; | |
| if (gtmId) { | |
| TagManager.initialize({ gtmId }); |
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 requests | |
| import json | |
| import re | |
| import urllib.parse | |
| from datetime import datetime, date | |
| __all__ = [ | |
| "PayStacky" | |
| ] |
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, { useRef, useEffect } from "react": | |
| import { useIsFirstRender } from "react-busser"; | |
| import type { Ref } from "react"; | |
| const use = <D extends unknown>(promise: Promise<D>) => { | |
| }; | |
| export const useInuptValueUpdate = ({ value, defaultedValue = "" }) => { |
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 moment from 'moment' | |
| import { useState, useEffect } from 'react' | |
| export const useCurrentTime = (formatting = 'hh:mm A', intervalDuration = (1000 * 60)) => { | |
| const [currentTime, setCurrentTime] = useState(() => moment().format(formatting)) | |
| useEffect(() => { | |
| const updateTime = () => { | |
| setCurrentTime(moment().format(formatting)) | |
| } |
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
| const browserDoesSupportCSS_ScrollMarginTop = window.CSS.supports("scroll-margin-top", "10px"); | |
| const browserDoesSupportCSS_ScrollBehavior = window.CSS.supports("scroll-behavior", "smooth"); | |
| /* @NOTE: Simple helper to report if a DOM elements' bounding rectangle is partially within the viewport */ | |
| function isElementPartiallyOrWhollyWithinViewport_YAxis (element) { | |
| const rect = element.getBoundingClientRect(); | |
| const minimumYFrame = 0; | |
| const minimumXFrame = 0; | |
| const maximumYFrame = (window.innerHeight || document.documentElement.clientHeight); |
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
| package main | |
| import ( | |
| "bytes" | |
| "crypto/tls" | |
| "fmt" | |
| "log" |
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 { useRouter } from "next/navigation"; | |
| import { useEffect, useTransition } from "react"; | |
| const useNextJSAppRouteRefresh = ( | |
| { intervalDurationInMilliseconds = 0, autoRefreshOnMount = false }: { | |
| intervalDurationInMilliseconds: number, | |
| autoRefreshOnMount: boolean | |
| } | |
| ) => { | |
| const [isPending, startTransition] = useTransition(); |