Skip to content

Instantly share code, notes, and snippets.

View MartinsAlexandre's full-sized avatar

Martins Alexandre MartinsAlexandre

View GitHub Profile
@MartinsAlexandre
MartinsAlexandre / form.js
Created March 6, 2018 16:59
js http request
function requestApi (){
var api = "http://api.openweathermap.org/data/2.5/weather?q=";
var apiKey = "&APPID=5dbe8aa12a4dde7bbc49a832b7e2d5f7";
var units = "&units=metric";
var eltCity = document.getElementById("city");
var input = eltCity.value;
var url = api + input + apiKey + units;
@MartinsAlexandre
MartinsAlexandre / cowsay
Last active April 17, 2018 15:36
quete node cowsay
var cowsay = require("cowsay");
console.log(cowsay.say({
text : "hello boy",
e : "oO",
T : "U "
}));
// or cowsay.think()
process.stdin.resume()
process.stdin.setEncoding('utf8')
console.log('What\'s your age ? ')
process.stdin.on('data', (number) => {
if (!isNaN(number) && number < 99) {
calcul(number);
}
function calcul(number) {
class Monster {
constructor(options = {}){
this.health = 100;
this.name = options.name;
}
soigner () {
this.health = this.health + 10;
return this.health;
const address = {
city: "Lyon",
state: "FR",
zip: 69001
};
const sportList = ['Football', 'BasketBall']
const ortherSportList = ['Boxe', 'Judo']
const address = {
city: "Lyon",
state: "FR",
zip: 69001
};
const sportList = ['Football', 'BasketBall']
const ortherSportList = ['Boxe', 'Judo']
@MartinsAlexandre
MartinsAlexandre / noe.ts
Created March 12, 2018 17:05
TypeScript part2
class Animal {
}
class Chat extends Animal {
quatreP: boolean;
}
class Chien extends Animal {
quatreP: boolean;
}
@MartinsAlexandre
MartinsAlexandre / challenge.ts
Last active March 12, 2018 09:52
challenge typeScript 1
function hello(name : string) {
console.log("Hello " + name);
}
let firstName = "bob";
hello(firstName);
hello(firstName + " marley");
<script>
const profile = {
name: 'Alex',
getName() {
return this.name;
}
};
console.log(profile.getName());
</script>
<script>
let city = "La Loupe, ou pas !";
let age = "26";
const dateOfBirth = "03/08/1991";
let sentence = `J'habite à ${city}, j'ai ${age} ans, et je suis né le ${dateOfBirth}`
console.log(sentence);
</script>