Skip to content

Instantly share code, notes, and snippets.

View leonidkuznetsov18's full-sized avatar
:electron:
stay hungry, stay foolish

Leonid Kuznetsov leonidkuznetsov18

:electron:
stay hungry, stay foolish
View GitHub Profile

Setup multiple git identities & git user informations

/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉

Setup multiple git ssh identities for git

  • Generate your SSH keys as per your git provider documentation.
  • Add each public SSH keys to your git providers acounts.
  • In your ~/.ssh/config, set each ssh key for each repository as in this exemple:
@leonidkuznetsov18
leonidkuznetsov18 / multiple_ssh_setting.md
Created June 30, 2020 11:11 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@leonidkuznetsov18
leonidkuznetsov18 / strong-password-regex.md
Last active June 16, 2020 08:00 — forked from arielweinberger/strong-password-regex.md
Strong password Regular Expression - NestJS Course
  • Passwords will contain at least 1 upper case letter
  • Passwords will contain at least 1 lower case letter
  • Passwords will contain at least 1 number or special character
  • There is no length validation (min, max) in this regex!

Regular expression for JavaScript:

/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/
@leonidkuznetsov18
leonidkuznetsov18 / Eyeballing-This.md
Created May 27, 2020 12:52 — forked from zcaceres/Eyeballing-This.md
Understanding Binding and 'this' in Javascript

How to Eyeball Your ‘This’ Context in Javascript

The early programmer struggles with the Javascript keyword this. But understanding your this context is easier than it seems.

This is all about where a function is invoked. Often, early programmers worry about where the function was declared. Perhaps the function was declared in a specific file or a particular object. Surely this changes it's this!

Nope.

To understand this, we need to see where it is invoked. Nothing else matters, with one exception which we'll cover in a moment.

@leonidkuznetsov18
leonidkuznetsov18 / connect.js
Created December 4, 2019 10:55 — forked from ronen-e/connect.js
Redux connect implementation
function connect(mapStateToProps, mapDispatchToProps) {
return function connector(Component) {
class ContainerComponent extends React.Component {
componentDidMount() {
const { store } = this.context;
this.unsubscribe = store.subscribe(() => this.forceUpdate());
}
componentWillUnmount() {
this.unsubscribe();
@leonidkuznetsov18
leonidkuznetsov18 / isDblTouchTap.js
Created January 31, 2018 09:18 — forked from MoOx/isDblTouchTap.js
Double touch tap workaround for React based on onTouchTap (react-tap-event-plugin)
const dblTouchTapMaxDelay = 300
let latestTouchTap = {
time: 0,
target: null,
}
export default function isDblTouchTap(event) {
const touchTap = {
time: new Date().getTime(),
target: event.currentTarget,