Skip to content

Instantly share code, notes, and snippets.

View yarabramasta's full-sized avatar
🥐

Yara Bramasta yarabramasta

🥐
View GitHub Profile
@yarabramasta
yarabramasta / jsonEndpoint.ts
Created August 2, 2023 16:45
Contract based Express.js JSON endpoint made with Zod
import { ZodError, type z } from 'zod';
import { type Callback, type Handler, type InputType } from './types';
export default function jsonEndpoint<I, O, E>(
input: {
type: InputType;
schema: z.Schema<I>;
},
output: z.Schema<O>,
@yarabramasta
yarabramasta / use-query-params.ts
Last active July 17, 2023 12:58
Type-safe wrapper for Next.js useSearchParams hook
// Code by: Yara Bramasta (yarabram111@gmail.com)
import { useSearchParams } from 'next/navigation';
import { type z } from 'zod';
/**
* **Wrapper around Next.js useSearchParams hook**
*
* This hook is used to safely parse query params from the URL with `zod`.
@yarabramasta
yarabramasta / .bashrc
Created December 27, 2022 10:01
.bashrc
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
source ~/.git-prompt.sh
PS1='[\u@\h on \w$(__git_ps1 " -  %s")]\n[גּ]\$ '
@yarabramasta
yarabramasta / 30-touchpad.conf
Last active December 27, 2022 10:05
Linux Multitouch Gestures
# /etc/X11/xorg.conf.d/30-touchpad.conf
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on"
Option "TappingButtonMap" "lmr"
Option "NaturalScrolling" "true"
EndSection
@yarabramasta
yarabramasta / firebase_auth_x_next_js.md
Last active August 21, 2022 14:05
Firebase Auth x Next JS

Firebase App Configuration

Import this on top of application entry, such as pages/_app.tsx

NOTE: Make sure to import without resolving it import '../lib/firebase'

// firebase.ts

// import { getAnalytics } from 'firebase/analytics';