Skip to content

Instantly share code, notes, and snippets.

View bhaveshxrawat's full-sized avatar

Bhavesh Rawat bhaveshxrawat

View GitHub Profile
import { api } from "@netflix-comments/backend/convex/_generated/api";
import { createFileRoute, notFound } from "@tanstack/react-router";
import { createServerFn } from "@tanstack/react-start";
import { ConvexHttpClient } from "convex/browser"; //This import itself makes it a little sus since the package seems to be build for browser (client)
import z from "zod";
const convex = new ConvexHttpClient(process.env.CONVEX_URL as string);
const validatesTitle = createServerFn()
.validator(
z.object({
{
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
"linter": {
"rules": {
"performance": {
"noImgElement": "off"
},
"correctness": {
"noUnusedVariables": "warn",
"noUnusedImports": "warn",
@bhaveshxrawat
bhaveshxrawat / Dockerfile
Created September 23, 2024 12:40
Dockerfile Template
# set the base image to create the image for react app
FROM node:20-alpine
# create a user with permissions to run the app
# -S -> create a system user
# -G -> add the user to a group
# This is done to avoid running the app as root
# If the app is run as root, any vulnerability in the app can be exploited to gain access to the host system
# It's a good practice to run the app as a non-root user
RUN addgroup app && adduser -S -G app app
@bhaveshxrawat
bhaveshxrawat / index.html
Last active March 1, 2024 16:21
Intersection Observer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Intersection Observer</title>
<link rel="stylesheet" href="style.css">
<script defer src="script.js"></script>
</head>
<body>