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 { DependencyList, useCallback, useEffect, useRef } from 'react'; | |
| const raf = | |
| typeof window !== 'undefined' | |
| ? window.requestAnimationFrame || | |
| ((cb: FrameRequestCallback) => window.setTimeout(() => cb(Date.now()), 1_000 / 60)) | |
| : () => undefined; | |
| const caf = typeof window !== 'undefined' ? window.cancelAnimationFrame || window.clearTimeout : () => undefined; |
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 { hooks } from '@adonisjs/core/app' | |
| import { cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises' | |
| import path from 'node:path' | |
| const PACKAGE_PREFIX = 'flowshub-' | |
| export default hooks.buildFinished(async (bundler) => { | |
| const repoRoot = path.resolve(bundler.cwdPath, '../../') | |
| const buildDir = path.join(bundler.cwdPath, 'build') |
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 type { HttpContext } from '@adonisjs/core/http' | |
| import app from '@adonisjs/core/services/app' | |
| import router from '@adonisjs/core/services/router' | |
| import { RuntimeException } from '@poppinss/utils/exception' | |
| const transmit = await app.container.make('transmit') | |
| transmit.authorize<{ id: string }>('users/:id', async (ctx: HttpContext, params) => { | |
| const userId = ctx.auth.user?.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
| <?php | |
| declare(strict_types=1); | |
| namespace App\Concerns; | |
| use Closure; | |
| use Inertia\Inertia; | |
| use Inertia\Response; | |
| use InertiaUI\Modal\Modal; |
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
| /** | |
| * Get media file duration in seconds. | |
| */ | |
| export function getMediaDuration(file: File): Promise<number> { | |
| if (!window.getMediaDurationCache) { | |
| window.getMediaDurationCache = new WeakMap(); | |
| } | |
| const cached = window.getMediaDurationCache.get(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
| import * as React from 'react'; | |
| const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect; | |
| export { useIsomorphicLayoutEffect }; |
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 { | |
| Command, | |
| CommandEmpty, | |
| CommandGroup, | |
| CommandItem, | |
| CommandList, | |
| } from '@/components/ui/command' | |
| import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover' | |
| import { useControlledState } from '@/hooks/use-controlled-state' | |
| import { useIsomorphicLayoutEffect } from '@/hooks/use-isomorphic-layout-effect' |
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 | |
| namespace App\Http\Middleware; | |
| use Closure; | |
| use Illuminate\Http\Request; | |
| use Symfony\Component\HttpFoundation\Response; | |
| class ContentNegotiator | |
| { |
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 { useIsomorphicLayoutEffect } from '@/hooks/use-isomorphic-layout-effect'; | |
| import { useCallback, useRef, useState } from 'react'; | |
| import { flushSync } from 'react-dom'; | |
| export function useControlledState<T>( | |
| initialValue: T, | |
| controlledValue?: T, | |
| onChange?: (value: T) => void, | |
| ): [T, (value: T | ((prev: T) => T)) => void] { | |
| const [internalValue, setInternalValue] = useState(initialValue); |
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 parseSeparated(text: string, delimiter: string = ','): string[][] { | |
| const rows: string[][] = []; | |
| let field = ''; | |
| let row: string[] = []; | |
| let inQuotes = false; | |
| for (let i = 0; i < text.length; i++) { | |
| const char = text[i]; | |
| const next = text[i + 1]; |
NewerOlder