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
/* | |
The purpose of this script is to daily check Packt's Free Book offer | |
and notify via e-mail with the title of the book and link to download page | |
-> https://www.packtpub.com/packt/offers/free-learning | |
Author: Douglas Matoso - www.dmatoso.com | |
Instructions: | |
1) Create a new Google Script at http://script.google.com | |
2) Paste the code below, putting your email in the "email" var. |
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
class UserList extends React.Component { | |
constructor () { | |
super(); | |
this.state = { | |
users: [] | |
}; | |
} | |
componentDidMount () { | |
fetch('/users').then(users => { |
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
class UserList extends React.Component { | |
render () { | |
return ( | |
<ul> | |
{this.props.users.map(user => <li key={user.id}>{user.name}</li>)} | |
</ul> | |
); | |
} | |
} |
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
class UserListContainer extends React.Component { | |
constructor () { | |
super(); | |
this.state = { | |
users: [] | |
}; | |
} | |
componentDidMount () { |
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 UserList = (props) => { | |
return ( | |
<ul> | |
{props.users.map(user => <li key={user.id}>{user.name}</li>)} | |
</ul> | |
); | |
}; |
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
class UserListContainer extends React.Component { | |
... | |
toggleActive (event) { | |
// event logic | |
} | |
render () { | |
return ( | |
<UserList users={this.state.users} toggleActive={this.toggleActive} /> |
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
// criar uma função que recebe uma lista de alunos | |
// e loga (console.log) se o aluno foi aprovado, | |
// ou o motivo da reprovação. Ex: | |
// Fulano foi aprovado(a) | |
// Fulano foi reprovado(a) por nota | |
// Fulano foi reprovado(a) por faltas | |
// OBS.: Critérios de aprovação: nota maior ou igual a 6 e | |
// faltas menor que 25% do total de aulas | |
var totalAulas = 30; |
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
import React from 'react' | |
import './icons.svg' | |
const Icon = (props) => ( | |
<svg className={`icon icon-${props.name}`}> | |
<use xlinkHref={`#icons_${props.name}`} /> | |
</svg> | |
) | |
export default Icon |
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 path = require('path') | |
module.exports = { | |
entry: './src/index.js', | |
output: { | |
path: path.resolve('dist'), | |
filename: 'bundle.js' | |
}, |
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
// the request: | |
// GET information about the latest React release on GitHub | |
// we don't need to inform the method (GET is the default), | |
// headers or body (GET request doesn't need one) | |
fetch('https://api.github.com/repos/facebook/react/releases/latest') // the URI | |
.then(response => { | |
// we received the response and print the status code | |
console.log(response.status) | |
// return response body as JSON | |
return response.json() |
OlderNewer