Skip to content

Instantly share code, notes, and snippets.

View eduardoviscencio's full-sized avatar
👋
Hi!

Eduardo Viscencio eduardoviscencio

👋
Hi!
View GitHub Profile
@eduardoviscencio
eduardoviscencio / zod-optional-null.ts
Created May 19, 2024 16:29 — forked from ciiqr/zod-optional-null.ts
zod optional/nullable/nullish differences
// zod schema
z.object({
// valid if string or:
optional: z.string().optional(), // field not provided, or explicitly `undefined`
nullable: z.string().nullable(), // field explicitly `null`
nullish: z.string().nullish(), // field not provided, explicitly `null`, or explicitly `undefined`
});
// type
{
@eduardoviscencio
eduardoviscencio / current-dir-in-iterm-tab-title.sh
Created September 1, 2023 20:09 — forked from phette23/current-dir-in-iterm-tab-title.sh
Set the iTerm tab title to the current directory, not full path.
# put this in your .bash_profile
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND";
fi
# Piece-by-Piece Explanation:
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too
# the $PROMPT_COMMAND environment variable is executed every time a command is run
# see: ss64.com/bash/syntax-prompt.html
@eduardoviscencio
eduardoviscencio / test-setup.ts
Created August 10, 2023 20:53 — forked from xiongemi/test-setup.ts
mock @react-navigation/native for unit testing
jest.mock('@react-navigation/native', () => {
return {
useNavigation: () => ({
navigate: jest.fn(),
dispatch: jest.fn(),
}),
useRoute: () => ({
params: {
id: '123',
},
import React from 'react';
import { render, fireEvent } from 'react-native-testing-library';
import Home from '../../pages/Home';
const mockedNavigation = jest.fn();
jest.mock('@react-navigation/native', () => {
return {
useNavigation: () => ({

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.