Skip to content

Instantly share code, notes, and snippets.

View svngoku's full-sized avatar
🦩
Your favorite Teachlead 🥸

svngoku

🦩
Your favorite Teachlead 🥸
View GitHub Profile
@svngoku
svngoku / main.py
Created November 3, 2018 19:09
UnitTest Python3 created by svngoku - https://repl.it/@svngoku/UnitTest-Python3
# 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()
@svngoku
svngoku / main.js
Created December 26, 2018 01:08
ES6Module created by svngoku - https://repl.it/@svngoku/ES6Module
/* 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]
@svngoku
svngoku / main.js
Created December 26, 2018 23:40
Promise created by svngoku - https://repl.it/@svngoku/Promise
/* 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)
});
@svngoku
svngoku / index.js
Created December 29, 2018 00:30
SendMail 📧 created by svngoku - https://repl.it/@svngoku/SendMail
/* Send mail With NodeJS */
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'youremail@gmail.com',
pass: 'yourpassword'
}
@svngoku
svngoku / main.py
Last active January 8, 2019 15:27
Fibonacci series created by svngoku - https://repl.it/@svngoku/Fibonacci-series
## 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)
@svngoku
svngoku / main.js
Created December 30, 2018 23:44
PascalTriangle created by svngoku - https://repl.it/@svngoku/PascalTriangle
/* Pascal Triangle II */
const getItem = (row,j) => {
if (j < 0 || j >= row.length) {
return 0;
}
return row[j];
}
const getRow = (rowIndex) => {
@svngoku
svngoku / main.js
Created January 5, 2019 22:57
EloquentJavaScriptExerciceLoop 🔁 created by svngoku - https://repl.it/@svngoku/EloquentJavaScriptExerciceLoop
/* 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 += "#";
}
@svngoku
svngoku / translate.js
Last active January 5, 2019 23:47
Translation with prompt
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."
}
console.log('🤯')
let js = "JavaScript"
console.log(`Master language of the web 🌐 is ${js}`)
// Master language of the web 🌐 is JavaScript
@svngoku
svngoku / index.php
Last active January 6, 2019 02:31
Simple php view
<?php
class Language {
private $name;
static function php($name) {
echo $name." is mainly focused on server-side scripting,
so you can do anything 🐘 \n";
}
}