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
<input type="text" maxlength="6"> | |
<style> | |
input[type=text] { | |
--w: 1ch; /* control the width for each letter */ | |
--g: .15em; /* the gap between letters */ | |
--b: 2px; /* the border thickness */ | |
--c: #888; | |
--_n: attr(maxlength type(<integer>)); |
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 push { | |
param ( | |
[string]$message | |
) | |
git add . | |
git commit -m $message | |
git push | |
} |
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 vscode from 'vscode'; | |
import { Ollama } from 'ollama'; | |
let panel: vscode.WebviewPanel | undefined = undefined; | |
// Initialize Ollama client | |
const ollama = new Ollama({ | |
host: 'http://localhost:11434' // default Ollama host | |
}); |
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 default function Home() { | |
let searchParams = useSearchParams(); | |
let [search, setSearch] = useState(searchParams.get('search') ?? ''); | |
let { data, isPlaceholderData } = useQuery({ | |
queryKey: ['people', search], | |
queryFn: async () => { | |
let res = await fetch(`/api/people?search=${search}`); | |
let data = await res.json(); |
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 { NextRequest, NextResponse } from 'next/server'; | |
import { words } from './words'; | |
export const dynamic = 'force-dynamic'; | |
const getRandomWord = () => { | |
const randomIndex = Math.floor(Math.random() * words.length); | |
return words[randomIndex]; | |
}; |
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 { headers } from "next/headers"; | |
export function geoLocation() { | |
const headersList = headers(); | |
return { | |
ip: headersList.get("x-real-ip"), | |
country: headersList.get("x-vercel-ip-country"), | |
city: headersList.get("x-vercel-ip-city"), | |
}; | |
} |
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 const copyToClipboard = async (dataUrl: string) => { | |
try { | |
// Convert the Data URL to a Blob | |
const response = await fetch(dataUrl); | |
const blob = await response.blob(); | |
// Check if the image is in a supported format, convert if necessary | |
let pngBlob = blob; | |
if (blob.type !== 'image/png') { |
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 const updateDocumentsWithVinyls = async () => { | |
try { | |
const collectionRef = collection(db, 'frames'); | |
const querySnapshot = await getDocs(collectionRef); | |
for (const docSnapshot of querySnapshot.docs) { | |
const documentData = docSnapshot.data(); | |
// Check if the document has a 'keywords' field and it's a comma-separated string |
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
// components/TopLoadingIndicator.js | |
import { useEffect, useState } from 'react'; | |
import { useRouter } from 'next/router'; | |
const TopLoadingIndicator = () => { | |
const router = useRouter(); | |
const [loading, setLoading] = useState(false); | |
useEffect(() => { | |
const handleStart = () => { |
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" | |
export function useDebounce( | |
value | |
delay | |
callback | |
) { | |
const [debouncedValue, setDebouncedValue] = React.useState(value) | |
React.useEffect(() => { |
NewerOlder