Skip to content

Instantly share code, notes, and snippets.

View cgimenes's full-sized avatar

Marcelo Gimenes de Oliveira cgimenes

View GitHub Profile
@Goganoid
Goganoid / useAutoSubmit.ts
Created September 4, 2024 17:04
react-hook-form autosubmit
import { debounce } from 'lodash';
import { useCallback, useEffect, useState } from 'react';
import { type UseFormWatch, type FieldValues, type UseFormTrigger, type Path } from 'react-hook-form';
interface AutoSubmitProps<T extends FieldValues> {
trigger: UseFormTrigger<T>;
watch: UseFormWatch<T>;
excludeFields?: Path<T>[];
onSubmit: () => void;
onValidationFailed?: () => void;
@bobuss
bobuss / Calisthenics.md
Last active March 31, 2024 09:41
The 9 Rules of Object Calisthenics

Object Calisthenics outlines 9 basic rules to apply when performing the exercise:

  • One level of indentation per method.
  • Don't use the ELSE keyword.
  • Wrap all primitives and Strings in classes.
  • First class collections.
  • One dot per line.
  • Don't abbreviate.
  • Keep all classes less than 50 lines.
  • No classes with more than two instance variables.