Example
commit -m 'PREFIX : COMMENT'
- prefix: 'fix', type: 'bug'
- prefix: 'chore', type: 'chore'
- prefix: 'test', type: 'chore'
import { useCallback, useState } from "react"; | |
// Custom hook to copy text to clipboard | |
const useCopyToClipboard = (timeoutDuration: number = 1000) => { | |
const [copied, setCopied] = useState(false); | |
const [error, setError] = useState<Error | null>(null); | |
const copyToClipboard = useCallback( | |
async (text: string) => { | |
try { |
import { useCallback, useEffect, useRef, useState } from "react"; | |
/** | |
* Custom React hook for double-click confirmation for critical actions. | |
* | |
* @param action - The action to be executed on the second click. | |
* @param timeout - Time in milliseconds to reset the unlocked state. | |
* @returns The current unlocked state and the trigger function. | |
*/ | |
const useConfirmation = (action: () => void, timeout: number = 5000) => { |
import { useEffect, useState } from "react"; | |
function useLocalStorage() { | |
const [loadingStates, setLoadingStates] = useState<Map<string, boolean>>( | |
new Map() | |
); | |
const setStorageValue = <T>(key: string, value: T) => { | |
try { | |
window.localStorage.setItem(key, JSON.stringify(value)); |
import { useEffect, useState } from "react"; | |
const defaultEvents = [ | |
"mousemove", | |
"mousedown", | |
"touchstart", | |
"keydown", | |
"wheel", | |
"resize", | |
]; |
import { useCallback, useEffect, useRef, useState } from "react"; | |
interface UseUndoHook<T> { | |
value: T; | |
onChange: (newValue: T) => void; | |
undo: () => void; | |
redo: () => void; | |
clear: () => void; | |
canUndo: boolean; | |
canRedo: boolean; |
import openai # pip install openai | |
import typer # pip install "typer[all]" | |
from rich import print # pip install rich | |
from rich.table import Table | |
""" | |
Webs de interés: | |
- Módulo OpenAI: https://github.com/openai/openai-python | |
- Documentación API ChatGPT: https://platform.openai.com/docs/api-reference/chat | |
- Typer: https://typer.tiangolo.com |
[ | |
{ | |
"value": "Dateline Standard Time", | |
"abbr": "DST", | |
"offset": -12, | |
"isdst": false, | |
"text": "(UTC-12:00) International Date Line West" | |
}, | |
{ | |
"value": "UTC-11", |
Example
commit -m 'PREFIX : COMMENT'
import { createGlobalStyle } from "styled-components"; | |
// OPCION : Agregar el archivo fisico de la font | |
// import RobotoWoff from "./fonts/roboto-condensed-v19-latin-regular.woff"; | |
// export const GlobalStyle = createGlobalStyle` | |
// @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;500&display=swap'); |