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
// Objeto Inicial | |
const refeicao = { | |
id: 1, | |
descricao: 'Café da Manhã' | |
} | |
// Destructuring + Rest - Removendo valores | |
const { id, ...refeicaoSemId } = refeicao | |
console.log(refeicaoSemId) // { descricao: 'Café da Manhã' } | |
console.log(id) // 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
// Objeto Inicial | |
const refeicao = { | |
id: 1, | |
descricao: 'Café da Manhã' | |
} | |
// Extraindo Valores | |
const { descricao } = refeicao | |
console.log(descricao) // Café da Manhã |
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
// Objeto Inicial | |
const refeicao = { | |
id: 1, | |
descricao: 'Café da Manhã' | |
} | |
// Atualizando valores | |
const atualizandoRefeicao = { | |
...refeicao, | |
descricao: 'Café das 09hrs' |
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
// Objeto Inicial | |
const refeicao = { | |
id: 1, | |
descricao: 'Café da Manhã' | |
} | |
// Adicionando novos items | |
const adicionandoNovaPropriedade = { | |
...refeicao, | |
calorias: 600 |
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
//Módulo dotenv (variaveis do sistema) | |
require('dotenv').config({path: '../.env'}) | |
//Modulo para monitorar a pasta com arquivo da programação | |
const fs = require('fs') | |
//Modulo para leitura do xlsx | |
const xlsx = require('node-xlsx') | |
//Modulo para trabalhar com datas |
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
const defaultDiacriticsRemovalMap = [{ | |
'base': "A", | |
'letters': /(A|Ⓐ|A|À|Á|Â|Ầ|Ấ|Ẫ|Ẩ|Ã|Ā|Ă|Ằ|Ắ|Ẵ|Ẳ|Ȧ|Ǡ|Ä|Ǟ|Ả|Å|Ǻ|Ǎ|Ȁ|Ȃ|Ạ|Ậ|Ặ|Ḁ|Ą|Ⱥ|Ɐ|[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F])/g | |
}, { | |
'base': "AA", | |
'letters': /(Ꜳ|[\uA732])/g | |
}, { | |
'base': "AE", | |
'letters': /(Æ|Ǽ|Ǣ|[\u00C6\u01FC\u01E2])/g | |
}, { |
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
bot.onText(/\/eventos (.+)/, (msg, match) => { | |
const chatId = msg.chat.id | |
const resp = normalizer(match[1].trim()) | |
const urlTec = `https://www.sympla.com.br/eventos/${resp}?s=tecnologia` | |
axios.get(urlTec).then((response) => { | |
const $ = cheerio.load(response.data) | |
const data = [] | |
$('.event-box-link').each((i, elm) => { | |
data.push({ |
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
const TelegramBot = require('node-telegram-bot-api') | |
const TOKEN = '123345567:AAABBBCCCDDD1A22RbCdTyoIjYaTek' | |
const bot = new TelegramBot(TOKEN, { polling: true }) | |
bot.on('new_chat_members', (msg) => { | |
bot.sendMessage(msg.chat.id, `Olá ${msg.from.first_name}, bem vindo ao Devs SC!! Conte-nos um pouco sobre você, com o que trabalha e onde, se possivel é claro`) | |
}) |
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
var Horseman = require('node-horseman'); | |
var horseman = new Horseman(); | |
horseman | |
.open('http://www.angeloni.com.br/super/index') | |
.status() | |
.evaluate(function(){ | |
const descNode = document.querySelectorAll('.descr a') | |
const desc = Array.prototype.map.call(descNode, function (t) { return t.textContent }) |
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
const arr = [ | |
'h1', | |
'h2', | |
'h3' | |
] | |
const arr2 = [ | |
'p1', | |
'p2', | |
'p3', |