Skip to content

Instantly share code, notes, and snippets.

View WagnerMoreira's full-sized avatar

Wagner Moreira WagnerMoreira

View GitHub Profile
import {SetStateAction, useCallback} from 'react';
import {create} from "zustand";
export type EqualityFn<T> = (left: T | null | undefined, right: T | null | undefined) => boolean;
// eslint-disable-next-line @typescript-eslint/ban-types
const isFunction = (fn: unknown): fn is Function => (typeof fn === 'function');
/**
* Create a global state

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@WagnerMoreira
WagnerMoreira / javascript-remove-accents.js
Created September 2, 2021 12:37 — forked from marcelo-ribeiro/javascript-remove-accents.js
An Javascript function to remove accents and others characters from an input string.
// Example: https://codepen.io/marcelo-ribeiro/pen/OJmVOyW
const accentsMap = new Map([
["A", "Á|À|Ã|Â|Ä"],
["a", "á|à|ã|â|ä"],
["E", "É|È|Ê|Ë"],
["e", "é|è|ê|ë"],
["I", "Í|Ì|Î|Ï"],
["i", "í|ì|î|ï"],
["O", "Ó|Ò|Ô|Õ|Ö"],
@WagnerMoreira
WagnerMoreira / NavigationPrompt.jsx
Created August 12, 2020 20:18 — forked from bummzack/NavigationPrompt.jsx
A replacement component for the react-router `Prompt`.
import React from 'react';
import {withRouter} from 'react-router-dom';
import PropTypes from 'prop-types';
/**
* A replacement component for the react-router `Prompt`.
* Allows for more flexible dialogs.
*
* @example
* <NavigationPrompt when={this.props.isDirty}>

How to fix 'Could not restore untracked files from stash' issue

Convert a stash to a temporary branch

git stash branch STASHTEMPBRANCH

Apply your stash

git stash apply

@WagnerMoreira
WagnerMoreira / introrx.md
Created January 9, 2018 15:38 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@WagnerMoreira
WagnerMoreira / rxjs_operators_by_example.md
Created September 28, 2017 20:05 — forked from btroncone/rxjs_operators_by_example.md
RxJS 5 Operators By Example
@WagnerMoreira
WagnerMoreira / tmux-cheatsheet.markdown
Created August 18, 2017 00:28 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@WagnerMoreira
WagnerMoreira / tmux.md
Created August 18, 2017 00:28 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

Advanced JavaScript Learning Resources

This is a list of advanced JavaScript learning resources from people who responded to this [Tweet][13] and this [Tweet][20].

  • [You Don't Know JS][3]

  • [Frontend Masters courses by Kyle Simpson][12]

  • [@mpjme][6]'s [YouTube videos][5]