Skip to content

Instantly share code, notes, and snippets.

View deavial's full-sized avatar
😈
Up to no good, probably.

Deavial deavial

😈
Up to no good, probably.
View GitHub Profile
@sergiodxa
sergiodxa / remix-auth.ts
Created July 21, 2021 23:25
Remix authentication library usage example
// create a session storage instance
let sessionStorage = createCookieSessionStorage();
// create authenticator instance
let authenticator = new Authenticator<User>(
sessionStorage
);
// configure the authenticator to use the Auth0 strategy for sign-in
authenticator.use(
@sergiodxa
sergiodxa / .eslintrc.js
Created July 30, 2021 22:45
My favorite ESLint configuration
/* eslint-disable unicorn/prefer-module */
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: [
"@typescript-eslint",
"unicorn",
"import",
"react",
"prettier",
@sergiodxa
sergiodxa / entry.server.tsx
Last active December 5, 2024 08:05
Dynamically generate a PDF with Remix
import { renderToStream } from "@react-pdf/renderer";
import ReactDOMServer from "react-dom/server";
import { EntryContext, Headers, RemixServer, Request, Response } from "remix";
import PDF, { loader } from "./pdfs/my-pdf.server";
async function handlePDFRequest(request: Request, headers: Headers) {
// get the data for the PDF
let response = await loader({ request, context: {}, params: {} });
// if it's a response return it, this means we redirected
if (response instanceof Response) return response;