This file contains 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
# Unit Test With Python3 | |
import unittest | |
import test | |
class ModuleTest(unittest.TestCase): | |
def test_calcul(self): | |
assert(test.addition(2) == 4) | |
if __name__ == '__main__': | |
unittest.main() |
This file contains 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
/* ES6 Modules */ | |
/* strings */ | |
let str = 'Hello Papy'; | |
console.log(str.endsWith('Papy')); // true | |
/* Array */ | |
let a = [ 1,2,3,4,5]; | |
console.log(a.find(e => e % 3 === 0)); // 3 | |
console.log(a.findIndex(e => e % 3 === 0)); // 2 | |
[1,2,3].fill(4); // [4 ,4 ,4] |
This file contains 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
/* Promise : This code print the first and the second value */ | |
const p = Promise.resolve('hello') | |
p.then(val => { | |
console.log(val) | |
return `${val} world` | |
}).then(newVal => { | |
console.log(newVal) | |
}); |
This file contains 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
/* Send mail With NodeJS */ | |
var nodemailer = require('nodemailer'); | |
var transporter = nodemailer.createTransport({ | |
service: 'gmail', | |
auth: { | |
user: 'youremail@gmail.com', | |
pass: 'yourpassword' | |
} |
This file contains 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 of Fibonacci series | |
def fib(n): | |
a, b = 0, 1 | |
while a < n: | |
print(a , end= '') | |
a , b = b , a + b | |
print() | |
fib(2000) |
This file contains 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
/* Pascal Triangle II */ | |
const getItem = (row,j) => { | |
if (j < 0 || j >= row.length) { | |
return 0; | |
} | |
return row[j]; | |
} | |
const getRow = (rowIndex) => { |
This file contains 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
/* First exercice of Eloquent JavaScript Book about loop */ | |
/* Looping a Triangle */ | |
console.log("********* Triangle Loop *********") | |
function triangle(value) { | |
let t = "#"; | |
while(t.length <= value) { | |
console.log(t); | |
t += "#"; | |
} |
This file contains 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
console.log('🤯') | |
// translation test | |
let lang = [ 'fr' , 'en'] | |
let traduction = { | |
fr : { | |
py : "Python un langage de programmation interprété, de haut niveau, à usage général. Créé par Guido van Rossum et publié pour la première fois en 1991, Python repose sur une philosophie de conception qui met l’accent sur la lisibilité du code, en utilisant notamment des espaces significatifs. Il fournit des constructions qui permettent une programmation claire à la fois à petite et à grande échelle. En juillet 2018, Van Rossum a démissionné en tant que leader de la communauté linguistique." | |
}, | |
en : { | |
py : "Python an interpreted, high-level, general-purpose programming language. Created by Guido van Rossum and first released in 1991, Python has a design philosophy that emphasizes code readability, notably using significant whitespace. It provides constructs that enable clear programming on both small and large scales.[26] In July 2018, Van Rossum stepped down as the leader in the language community." | |
} |
This file contains 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
console.log('🤯') | |
let js = "JavaScript" | |
console.log(`Master language of the web 🌐 is ${js}`) | |
// Master language of the web 🌐 is JavaScript |
This file contains 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 | |
class Language { | |
private $name; | |
static function php($name) { | |
echo $name." is mainly focused on server-side scripting, | |
so you can do anything 🐘 \n"; | |
} | |
} |
OlderNewer