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
| <?php | |
| function recursiveCount() | |
| { | |
| //static to avoid reset of variable for each itterations | |
| static $countMax = 5; | |
| //On affiche | |
| echo $countMax; | |
| //On décrémente |
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
| 'use strict'; | |
| function recursive(x){ | |
| console.log(x); | |
| if(x === 0){ //end condition | |
| //end | |
| return 1; | |
| } else { | |
| //reset process until 0 |
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
| 'use strict'; | |
| function recursive(x){ | |
| console.log(x); | |
| if(Math.sign(x) === 1){ | |
| //positiv given | |
| if(x === 0){ | |
| //end | |
| return 1; |
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
| 'use strict'; | |
| const crypto = require("crypto"); | |
| module.exports = { | |
| generateUuid: function(){ | |
| let randomVal1 = crypto.randomBytes(16).toString('hex'); | |
| let randomVal2 = crypto.randomBytes(16).toString('hex'); | |
| let currentDate = new Date().getTime(); |
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
| 'use strict'; | |
| let str = "salut"; | |
| for(let x=0; x < [...str].length; x++){ | |
| console.log([...str][x]); | |
| } |
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
| $ php -d memory_limit=-1 /usr/local/bin/composer require your-package-name |
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
| 'use strict'; | |
| async function print(value) { | |
| return new Promise((resolve, reject) => { | |
| if(typeof value === 'string'){ | |
| setTimeout(() => resolve(value), 1000) | |
| } else { | |
| setTimeout(() => reject("string value param only."), 500) | |
| } |
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
| #!/bin/sh | |
| path=/Users/christopher/Development/backups/dumps/[Dump_folder]/[Dump_folder/db_name] | |
| for i in $(ls $path/*.bson) | |
| do | |
| echo mongorestore --drop $i --db mpec | |
| mongorestore --drop $i --db mpec | |
| done |
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 display(){ | |
| console.log("display called ...") | |
| return new Promise( (resolve, reject) => { | |
| setTimeout(function(){ | |
| console.log("display resolved !"); | |
| resolve("aurevoir"); | |
| }, 2000) | |
| }) |
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
| async run (modelsToSync){ | |
| console.log(";;;;;;;;; RUN STARTED ;;;;;;;;; "); | |
| console.log(` > ${modelsToSync}`); | |
| let dataToSync = []; | |
| for (let model in modelsToSync){ | |
| let promise = this.sync(model); | |
| dataToSync.push(promise); | |
| } | |
| try { |
OlderNewer