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
// Usando 'class' o 'new' chama o construtor e faz a mesma coisa com o 'this' | |
class Player { | |
constructor (name) { | |
// const this = {} | |
this.name = name | |
this.hp = 1000 | |
this.mp = 0 | |
// return this | |
} | |
} |
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 player = { | |
name: 'Cloud', | |
weapon: 'Fusion Sword', | |
sayNameAndAttack () { | |
console.log(this.name) | |
// Uma 'arrow function'! | |
// O 'this' dentro dela vai ser o mesmo que aqui fora | |
window.setTimeout(() => { | |
console.log(`${this.name} ataca com a ${this.weapon}`) |
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 fse = require('fs-extra') | |
const path = require('path') | |
const { promisify } = require('util') | |
const ejsRenderFile = promisify(require('ejs').renderFile) | |
const globP = promisify(require('glob')) | |
const config = require('../site.config') | |
const srcPath = './src' | |
const distPath = './public' |
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 five = require('johnny-five') | |
const board = new five.Board() | |
board.on('ready', () => { | |
console.log('ready!') | |
const led = new five.Led(11) | |
const photoResistor = new five.Sensor({ | |
pin: 'A2', | |
freq: 100 |
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 ExtractTextPlugin = require("extract-text-webpack-plugin") | |
const path = require('path') | |
module.exports = { | |
entry: { | |
main: './src/index.js', | |
base: './src/css/base.css', | |
admin: './src/css/admin.css' | |
}, |
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 { Broker, Investment, Transaction, BalanceUpdate } = require('./models'); | |
const test = async () => { | |
// create broker | |
const broker = await Broker.create({ name: 'Fooinvest' }); | |
// create investment | |
const investment = await Investment.create({ | |
name: 'Tesouro Foo', | |
BrokerId: broker.get('id') | |
}); |
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 expect = require('chai').expect; | |
const { Investment, Transaction } = require('../../src/models'); | |
describe('Transaction', () => { | |
describe('attributes', () => { | |
it('should have amount and date', async () => { | |
const transaction = await Transaction.create({ | |
amount: 1, | |
date: '2018-03-15' | |
}); |
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
scalar Date | |
type Query { | |
brokers(limit: Int): [Broker] | |
broker(id: ID!): Broker | |
investments(limit: Int): [Investment] | |
investment(id: ID!): Investment | |
} | |
type Broker { |
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 { GraphQLString } = require('graphql'); | |
const { Broker, Investment, BalanceUpdate, Transaction } = require('../models'); | |
module.exports = { | |
Query: { | |
brokers: (obj, args) => Broker.all(args), | |
broker: (obj, { id }) => Broker.findById(id), | |
investments: (obj, args) => Investment.all(args), | |
investment: (obj, { id }) => Investment.findById(id) | |
}, |
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
scalar Date | |
type Query { | |
brokers(limit: Int): [Broker] | |
broker(id: ID!): Broker | |
investments(limit: Int): [Investment] | |
investment(id: ID!): Investment | |
} | |
type Broker { |