https://fixtergeek.com/blog/que-son-generics-en-typescript-2023
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
# Tutorial https://www.daimto.com/how-to-get-a-google-access-token-with-curl/ | |
# YouTube video https://youtu.be/hBC_tVJIx5w | |
# Client id from Google Developer console | |
# Client Secret from Google Developer console | |
# Scope this is a space seprated list of the scopes of access you are requesting. | |
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes. | |
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=http://127.0.0.1&scope=[Scopes]&response_type=code | |
# Exchange Authorization code for an access token and a refresh token. |
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, useState } from "react"; | |
export const useDynamicSrc = (hd: string, low: string) => { | |
const [src, set] = useState(low ?? ""); | |
useEffect(() => { | |
const img = new Image(); | |
img.src = src; | |
img.onload = () => { |
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 EmailForm = ({ | |
isLoading, | |
error, | |
}: { | |
isLoading?: boolean; | |
error?: string | null; | |
}) => ( | |
<section> | |
<FeedbugDialog | |
isOpen={true} |
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/router" | |
export default function Char(){ | |
const router = useRouter() | |
const {charId} = router.query | |
return ( | |
<h2>Detalle de {charId} </h2> | |
) | |
} |
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 { Children, createContext, useContext, type ReactNode } from "react"; | |
const dialogContext = createContext<Record<string, any>>({}); | |
type DialogProps = { | |
isOpen?: boolean; | |
children: any; | |
onClose?: () => void; | |
}; | |
export default function Dialog({ |
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 jwt from 'jsonwebtoken'; | |
import nodemailer from 'nodemailer'; | |
export const verify = (token: string) => { | |
return new Promise((res) => { | |
jwt.verify(token, 'blissmo', (error, info) => { | |
if (error) { | |
return res({ message: error.message, isError: true }); | |
} | |
return res(info); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Primer proyecto</title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css"> | |
<link rel="stylesheet" href="style.css"> | |
<script defer src="index.js"></script> |
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 { json } from '@remix-run/node'; | |
import { Form, useActionData, useTransition } from '@remix-run/react'; | |
import { useEffect, useRef } from 'react'; | |
import useRecorder from '~/components/useRecorder'; | |
import fs from 'fs'; | |
export const action = async ({ request }) => { | |
const formData = await request.formData(); | |
const file = formData.get('audio'); | |
const ab = await file.arrayBuffer(); |
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 { Product } from '@prisma/client'; | |
import type { LoaderFunction } from '@remix-run/node'; | |
import { Link, useLoaderData } from '@remix-run/react'; | |
import { db } from '~/db/db.server'; | |
interface LoaderData { | |
products: Product[]; | |
count: number; | |
pageNumber: number; | |
} |
NewerOlder