Skip to content

Instantly share code, notes, and snippets.

View wesdeveloper's full-sized avatar
🏠
Working from home

Wesley Amaral Lopes wesdeveloper

🏠
Working from home
View GitHub Profile
import React from 'react'
import ChipInput from 'material-ui-chip-input'
class Chip extends React.Component {
constructor(props) {
super(props)
this.state = {
chips: [],
limit: 3
}
const request = require('request')
const [comand, path, ...urls] = [...process.argv]
const searchs = []
const searchHttp = (url) => new Promise((resolve, reject) =>
request(url, (err, response, body) => err ? reject(err) : resolve(body)))
urls.map((url) => searchs.push(searchHttp(url)))
Promise.all(searchs).then((results) =>
const fs = require('fs')
let texto = 'Coffee is life!'
const escreve = (file, texto) => new Promise((resolve, reject) => fs.writeFile(file, texto, (err) => err ? reject(err) : resolve()))
escreve('teste.txt', texto)
.then(() => console.log('Deu certo..'))
.catch(() => console.log('Deu ruim... TRATAR'))
@wesdeveloper
wesdeveloper / media.js
Created February 25, 2017 04:27
Function calcula média
function media(...arguments) {
total = arguments.reduce((a,b) => a+b);
return total/arguments.length;
}
console.log(media(12,6,6,3));