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 showPhrase() { | |
if (true) { | |
let phrase = 'JavaScript é sensacional!'; | |
console.log(phrase); // JavaScript é sensacional! | |
} | |
console.log(phrase); // prhase is not defined | |
} | |
showPhrase(); |
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 showPhrase() { | |
phrase = 'JavaScript é sensacional!'; | |
console.log(phrase); | |
} | |
showPhrase(); // JavaScript é sensacional! | |
console.log(phrase); // JavaScript é sensacional! |
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 showPhrase() { | |
var phrase = 'JavaScript é sensacional!'; | |
console.log(phrase); | |
} | |
showPhrase(); // JavaScript é sensacional! | |
console.log(phrase); // phrase is not defined |
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
var phrase = 'JavaScript é sensacional!'; | |
function showPhrase() { | |
console.log(phrase); | |
} | |
showPhrase(); // JavaScript é sensacional! |
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
const server = require('net').createServer(); | |
const sockets = {}; | |
let counter = 0; | |
server.on('connection', socket => { | |
socket.id = counter++; | |
console.log('Client connected!'); | |
socket.write('Please type your name: '); |
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
const ThousandsSeparatorRegex = () => { | |
const format = (value, separator = ',') => { | |
const formatToThousands = (str, formater = ',') => str.toString().replace(/\B(?=(\d{3})+(?!\d))/g, formater); | |
if (value >= 0 || (value.length >= 0 && value.length <= 15)) { | |
const formatedThousands = formatToThousands(value, separator); | |
return formatedThousands; | |
} else if (value < 0) { | |
const formatedThousands = formatToThousands(value, separator); | |
return formatedThousands; |
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
const channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"]; | |
const colorsListItem = ["--yellow", "--coral", "--purple"]; | |
// Showing channel names and adding colored item | |
for(i=0;i<channels.length;i++){ | |
// Creating random value for item color | |
function randomColor(){ | |
number = Math.floor(Math.random()*colorsListItem.length); | |
color = colorsListItem[number]; |
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
//Dockerfile | |
FROM node:8.4.0 | |
ENV HOME=/home/app | |
COPY package.json $HOME/node_todo/ | |
WORKDIR $HOME/node_todo | |
RUN npm install --silent --progress=false |
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
const request = require('request'); | |
const cheerio = require('cheerio'); | |
const fs = require('fs'); | |
// Url a ser visitada | |
const pageToVisit = 'http://www.suapesquisa.com/geografia/siglas_estados_brasileiros.htm'; | |
console.log('Visiting page ' + pageToVisit); | |
request(pageToVisit, function (error, response, body) { | |
if (error) { |
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
module.exports = { | |
"extends": "airbnb", | |
"plugins": [ | |
"react", | |
"jsx-a11y", | |
"import" | |
], | |
rules: { | |
"max-len": 1, | |
"no-console": 0, |