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 sharp from "sharp"; | |
| import { Media } from "./collections/Media"; | |
| /** | |
| * @see https://github.com/payloadcms/payload/discussions/1834 | |
| */ | |
| export const regenerateMediaSizes = async ({ media, payload }) => { | |
| try { | |
| await Promise.all( | |
| media.docs.map(async (mediaDoc) => { |
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 fs = require("fs"); | |
| const path = require("path"); | |
| const nodeUtils = require("../utils/node.utils"); | |
| const directoryPath: string = path.join(__dirname, "../assets/icons"); | |
| fs.readdir( | |
| directoryPath, | |
| (err: NodeJS.ErrnoException | null, files: string[]) => { | |
| if (err) { |
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 {useState, useEffect} from 'react'; | |
| // Define a type for the prerequisite check function | |
| type PrerequisiteCheck = () => Promise<any>; | |
| export default function useUserPrerequisites( | |
| prerequisiteChecks: PrerequisiteCheck[] = [], | |
| ) { | |
| const [userHasPrerequisite, setUserHasPrerequisites] = useState(false); | |
| const [isLoading, setIsLoading] = useState(true); | |
| useEffect(() => { | |
| const checkPrerequisites = async () => { |
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, { useState, useEffect } from 'react'; | |
| import { View, Text, Image, AppState } from 'react-native'; | |
| const App = () => { | |
| const [appState, setAppState] = useState(AppState.currentState); | |
| const [isAppBackgrounded, setIsAppBackgrounded] = useState(false); | |
| useEffect(() => { | |
| const subscription = AppState.addEventListener("change", nextAppState => { | |
| setAppState(nextAppState); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| { | |
| "Africa/Abidjan": [8, -5], | |
| "Africa/Accra": [8, -2], | |
| "Africa/Addis_Ababa": [8, 38], | |
| "Africa/Algiers": [28, 3], | |
| "Africa/Asmara": [15, 39], | |
| "Africa/Bamako": [17, -4], | |
| "Africa/Bangui": [7, 21], | |
| "Africa/Banjul": [13.46666666, -16.56666666], | |
| "Africa/Bissau": [12, -15], |
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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
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 waitFor(ms: number): Promise<void> { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| export default async function fetchRetry(promise: Promise<unknown>, n: number, waitNseconds = 1000): Promise<unknown> { | |
| try { | |
| return await promise; | |
| } catch (error) { | |
| if (n === 1) throw 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
| import { useEffect, useRef } from 'react'; | |
| import { useDispatch } from 'react-redux'; | |
| function useReduxPolling(action: any, interval = 2000): void { | |
| const dispatch = useDispatch(); | |
| const callback = useRef(action); | |
| useEffect(() => { | |
| callback.current = action; |
NewerOlder