Skip to content

Instantly share code, notes, and snippets.

View Hachikoi-the-creator's full-sized avatar
😉
Exited

Adan Moreno Hachikoi-the-creator

😉
Exited
View GitHub Profile
import React, { useState } from "react";
import { auth } from "../firebase";
import {
signInWithPopup,
GoogleAuthProvider,
AuthProvider,
getAuth
} from "firebase/auth";
import { useAuthState } from "react-firebase-hooks/auth";
model Owner {
id Int @id @default(autoincrement())
name String
dogs Dog[]
}
model Dog {
id Int @id @default(autoincrement())
name String
age Int @default(1)
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
// * DOGGOS
const fetchAllDoggos = async () => {
const dogs = await prisma.dog.findMany({ include: { owner: true } });
console.log(dogs);
};
import Fastify, { FastifyReply, FastifyRequest } from "fastify";
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
const server = Fastify();
// Route to check if the server is running
server.get("/ping", async (request, reply) => {
reply.send("Server is running");
});
@Hachikoi-the-creator
Hachikoi-the-creator / App.tsx
Last active October 25, 2024 03:37 — forked from nimone/Carousel.jsx
Build a carousel component like instagram purely in ReactJS, TS and TailwindCSS
import Carousel from "./Carousel";
import img1 from "path-to-local-image.jpg";
import img2 from "path-to-local-image.jpg";
import img3 from "path-to-local-image.jpg";
export default function ImageCarousel() {
const slides = [img1, img2, img3];
return (
<div className="relative">
@Hachikoi-the-creator
Hachikoi-the-creator / example.ts
Created July 19, 2023 01:36
avoid bad practice in data fetch+ TS
type SomeRes = {
id: number;
title: string;
};
const fetchSomeStuff = async () => {
const res = await fetch("...");
if (res.ok) {
const data: SomeRes = await res.json();
// no error even tho the link doesn't even exist