Skip to content

Instantly share code, notes, and snippets.

View AlexString's full-sized avatar
Coffee love

Alex String AlexString

Coffee love
View GitHub Profile
@AlexString
AlexString / dirtyFields.ts
Last active February 27, 2023 01:25
React-Hook-Form | custom Helper | getDirtyFieldsOnly with Generic Type TypeScript
/**
* I found this helper useful
* the defaultValues must be provided
* as the defaultValues are compared to the input current values to determine wether is dirty.
*/
import { DeepMap } from "react-hook-form";
function getDirtyFieldsOnly<FormType> (formData: FormType, dirtyFields: DeepMap<FormType, true>):FormType {
//@ts-ignore
@AlexString
AlexString / horizontal_scrolling.md
Created June 13, 2022 18:56
Make a div have horizontal scrolling

Make div scroll horizontally

.horizontal-scroll {
  white-space: nowrap;
  position: relative;
  overflow-x: scroll;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
@AlexString
AlexString / settings.json
Last active April 28, 2022 18:52
VSCode Neovim plugin | Cool keybindings
{
// Start copying from title
//=============================================================================
// Vscode vim plugin
//=============================================================================
"vim.leader": "<space>", // leader key
// exclude keybindings from vscodevim
"vim.handleKeys": {
"<C-d>": false,
"<C-c>": false,
@AlexString
AlexString / removeBeepSound.md
Created February 13, 2022 20:54
Remove beep sound on Fedora XFCE

Found on the Arch Wiki

Instructions

sudo nano /etc/modprobe.d/nobeep.conf

Type:

@AlexString
AlexString / yarn_install_fix.md
Last active January 26, 2022 01:13
Fixing 'yarn install': permission denied.

Problem case

I encountered this problem:

  • yarn said something about a permission denied problem when trying to make 'mkdir node_modules'

This is solved applying what the user seanryanuk says in this issue

Instructions

  • Find what directory yarn is working on (should be your project folder, at least in my case)
  • do sudo chown -R yourUser yourProyectDirectory
@AlexString
AlexString / change_terminal_ranger.md
Created December 29, 2021 19:30
[Ranger file manager] Change default terminal
@AlexString
AlexString / opacity_alacritty_picom.md
Created December 26, 2021 01:08
Set opacity for Alacritty using Picom

Instructions

in .config/picom/picom.conf add:

opacity-rule = [
  "95:class_g = 'Alacritty'",
]

Where 95 is the opacity percentage.

@AlexString
AlexString / bashprompt.md
Last active December 24, 2021 01:12
My bash prompt

Prompt

PS1='\[\e[0m\]\u \[\e[0m\]( \[\e[0m\]$(git branch 2>/dev/null | grep '"'"'^*'"'"' | colrm 1 2) \[\e[0m\]) \[\e[0m\]\W \n\[\e[0m\]\$ \[\e[0m\]'

Example:

username ( master ) bin 
$ 
@AlexString
AlexString / firefox-dev.md
Created December 15, 2021 01:27
Install Firefox Dev Edition on Linux
@AlexString
AlexString / instructions.md
Last active December 26, 2021 01:10
[ Typescript + React on VSCode] * How to fix * error TS2602: JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist