// update your local git repository
git remote update
// update your master branch
git checkout master
git pull
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const subUser = /** @type {SubUserType} */ (/** @type {unknown} */ (user)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Asynchronous JavaScript basics | |
// Asynchronous programming is a way to execute code | |
// without blocking the execution of the rest of the program. | |
// We commonly use the asynchronous syntax when we need to | |
// => Get data from another website or API | |
// => Retrieving / storing data in a database | |
// => Write / Read files from file system |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// COMMON OPERATIONS ON ARRAYS: | |
// CREATE A NEW VARIABLE | |
// Array.map => create a new array from an existing array. Each return is a new element of the new array | |
// Array.filter => create a new array: keeps elements when return true, removes elements when return false | |
// Array.reduce => create something new (number, string, object, array...) from an existing array. return adds things to the accumulator (acc) | |
// EXECUTE SIDE EFFECTS | |
// Array.foreach => Do stuff with each array item (it does not return anything) |
code ~/.gitconfig
[core]
excludesfile = ~/.gitignore_global
code ~/.gitignore_global
.idea/
.vscode/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getVatNumberFromSiren($siren) | |
{ | |
$prefix = ((($siren%97)*3)+12)%97; | |
if ($prefix < 10) { | |
$prefix = "0{$prefix}"; | |
} | |
return "FR{$prefix}{$siren}"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
NewerOlder