Skip to content

Instantly share code, notes, and snippets.

@pedrofracassi
Created April 8, 2020 18:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedrofracassi/485b8393f7bcf64fe8aae0bbea0070e2 to your computer and use it in GitHub Desktop.
Save pedrofracassi/485b8393f7bcf64fe8aae0bbea0070e2 to your computer and use it in GitHub Desktop.
Script usado pra formatar as respostas de um .txt pra tarefa "Cadê" da Ginconecta 2020.
const clipboardy = require('clipboardy');
const fs = require('fs')
let last = ''
setInterval(() => {
fs.readFile('palavras.txt', 'utf8', function(err, data) {
const resposta = `Equipe: Oficina / Resposta: ${data.split('\r\n').map(w => w.charAt(0).toUpperCase() + w.slice(1)).sort().join(', ')}`
if (resposta !== last) {
last = resposta
clipboardy.writeSync(resposta)
console.log(resposta)
}
});
}, 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment