code ~/.gitconfig
[core]
excludesfile = ~/.gitignore_global
code ~/.gitignore_global
.idea/
.vscode/
| const promise = (number) => new Promise(resolve => { | |
| setTimeout(() => resolve(number), Math.random() * Math.floor(1000)) | |
| }) | |
| const sequentialIteration = async () => { | |
| for (const number of Array(10).keys()) console.log(await promise(number)) | |
| } | |
| sequentialIteration() |
| [alias] | |
| b = branch -vv | |
| ba = branch -a -vv | |
| bb = branch | |
| cb = checkout -b | |
| cm = checkout master | |
| cma = checkout main | |
| cnv = commit -m --no-verify | |
| co = checkout | |
| d = branch -D |
| // A simple way to extract strings and numbers from an enum | |
| enum actions { | |
| Link = 1, | |
| Unlink = 0 | |
| } | |
| const strings = Object.keys(actions) | |
| .filter((key) => Number.isNaN(parseFloat(key))) |
| // array some helps keeping code succinct when looking for occurences in arrays | |
| const firstArray = ['shark', 'fish', 'dinosaur'] | |
| const secondArray = ['whale', 'shark', 'bird'] | |
| const thirdArray = ['raptor', 'tuna'] | |
| // determine wether 2 arrays have a similar entry | |
| const bool1 = firstArray.some(animal => secondArray.some(otherAnimal => otherAnimal === animal)) | |
| console.log("bool1", bool1) // true, "shark" is in both arrays |
| /** | |
| * Rebase, having non-committed changes | |
| */ | |
| git remote update origin | |
| git stash | |
| git checkout master | |
| git pull | |
| git checkout MY_BRANCH | |
| git rebase master | |
| git stash pop |
| # Start ssh-agent at each session if necessary | |
| # Source: https://askubuntu.com/questions/878944/cant-store-passphrase-in-same-session-with-eval-ssh-agent-ssh-add | |
| sudo vim ~/.bashrc | |
| # | |
| # setup ssh-agent | |
| # | |
| #start running ssh-agent if it is not already. | |
| if [ ! 'root' = "${USER}" ]; then |
| function getVatNumberFromSiren($siren) | |
| { | |
| $prefix = ((($siren%97)*3)+12)%97; | |
| if ($prefix < 10) { | |
| $prefix = "0{$prefix}"; | |
| } | |
| return "FR{$prefix}{$siren}"; | |
| } |
code ~/.gitconfig
[core]
excludesfile = ~/.gitignore_global
code ~/.gitignore_global
.idea/
.vscode/