Skip to content

Instantly share code, notes, and snippets.

View ephraimduncan's full-sized avatar
📚
learning

Ephraim Duncan ephraimduncan

📚
learning
View GitHub Profile
@ephraimduncan
ephraimduncan / delete_node_modules.sh
Created March 23, 2024 13:26
Recursively delete all node_modules in all packages in a monorepo
find . -name "node_modules" -type d -prune -exec rm -rf '{}' + -exec sh -c 'echo "Deleted: $1"' _ {} \;
@ephraimduncan
ephraimduncan / signing-e2e.ts
Last active March 8, 2024 21:49
documenso signing document e2e
test('should be able to create, send and sign a document', async ({ page }) => {
await page.goto('/signin');
const documentTitle = `example-${Date.now()}.pdf`;
// Sign in
await page.getByLabel('Email').fill(TEST_USER.email);
await page.getByLabel('Password', { exact: true }).fill(TEST_USER.password);
await page.getByRole('button', { name: 'Sign In' }).click();
@ephraimduncan
ephraimduncan / render.yaml
Created September 18, 2023 09:14
Documenso Render Deploy feat/refresh
services:
- type: web
name: documenso-app
env: node
plan: free
buildCommand: npm i turbo && npm install --package-lock-only && npm ci && npm run build
startCommand: npx prisma migrate deploy; npm run start
healthCheckPath: /api/health
envVars:
@ephraimduncan
ephraimduncan / HomeScreen.jsx
Created August 24, 2023 03:28
Willman Fluxstore Homescreen
import { Image, ScrollView, Text, TouchableOpacity } from "react-native";
import { View } from "react-native";
import Container from "../components/Container";
import { SafeAreaView } from "react-native-safe-area-context";
import CategoryRow from "../components/CategoryRow";
import CollectionCard from "../components/CollectionCard";
import FeatureProducts from "../components/FeatureProducts";
import HangoutPartyCollection from "../components/HangoutPartyCollection";
import FontsProvider from "../components/FontsProvider";
import Recommended from "../components/Recommended";
@ephraimduncan
ephraimduncan / modal-presentation-react-native.js
Created July 8, 2023 13:12
Implementation of Modal Presentation for iOS in React Native
import React, { useState } from "react";
import {
Alert,
Modal,
Text,
Pressable,
View,
SafeAreaView,
} from "react-native";
@ephraimduncan
ephraimduncan / postgres.sh
Created April 9, 2023 11:34
Run PostgreSQL DB in Docker
docker run --name postgres-db -e POSTGRES_PASSWORD=docker -p 5432:5432 -d postgres
psql postgres
CREATE DATABASE databasename;
@ephraimduncan
ephraimduncan / WithAuth.tsx
Last active March 17, 2023 15:32
Auth Wrapper for `next-auth`
import { useSession } from "next-auth/react";
import { useRouter } from "next/router";
export default function WithAuth({ children }: { children: React.ReactNode }): JSX.Element {
const router = useRouter();
const { data, status } = useSession({
required: true,
onUnauthenticated() {
router.push("/api/auth/signin");
@ephraimduncan
ephraimduncan / Form.tsx
Created March 9, 2023 14:43
React Form with `react-hook-form` and `zod`
import { SubmitHandler, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
const validationSchema = z
.object({
firstName: z.string().min(1, { message: "Firstname is required" }),
lastName: z.string().min(1, { message: "Lastname is required" }),
email: z.string().min(1, { message: "Email is required" }).email({
message: "Must be a valid email",
@ephraimduncan
ephraimduncan / prevent-ds-store.sh
Created December 15, 2022 11:04
Prevent the creation of .DS_Store files in MacOS
defaults write com.apple.desktopservices DSDontWriteNetworkStores true