Skip to content

Instantly share code, notes, and snippets.

View doug2k1's full-sized avatar

Douglas Matoso doug2k1

View GitHub Profile
@doug2k1
doug2k1 / checkBook.gs
Last active January 19, 2017 14:14
Google Script to check Packt free book
/*
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.
class UserList extends React.Component {
constructor () {
super();
this.state = {
users: []
};
}
componentDidMount () {
fetch('/users').then(users => {
class UserList extends React.Component {
render () {
return (
<ul>
{this.props.users.map(user => <li key={user.id}>{user.name}</li>)}
</ul>
);
}
}
class UserListContainer extends React.Component {
constructor () {
super();
this.state = {
users: []
};
}
componentDidMount () {
const UserList = (props) => {
return (
<ul>
{props.users.map(user => <li key={user.id}>{user.name}</li>)}
</ul>
);
};
class UserListContainer extends React.Component {
...
toggleActive (event) {
// event logic
}
render () {
return (
<UserList users={this.state.users} toggleActive={this.toggleActive} />
// 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;
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
const path = require('path')
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve('dist'),
filename: 'bundle.js'
},
// 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()