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
| export default (fileInfo, api, options) => { | |
| const { path: rawPath, value, declarator = "theme" } = options; | |
| if (!rawPath || !value) { | |
| console.error("Pass paths AND value to change the code "); | |
| process.exit(1); | |
| } | |
| const paths = rawPath.split("."); | |
| const j = api.jscodeshift; | |
| const root = j(fileInfo.source); | |
| const possibleRoots = root.find(j.VariableDeclarator, { |
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
| { | |
| "FunctionalComponent": { | |
| "prefix": "reafc", | |
| "body": [ | |
| "import React, {FC} from 'react'", | |
| "", | |
| "export interface ${1:${TM_DIRECTORY/^.+\\/(.*)$/$1/}}Props {", | |
| "}", | |
| "", | |
| "export const ${1:${TM_DIRECTORY/^.+\\/(.*)$/$1/}}:FC<${1:${TM_DIRECTORY/^.+\\/(.*)$/$1/}}Props> = () => {", |
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
| _onInterval () { | |
| const now = Date.now() | |
| this.setState((oldState) => { | |
| let { score, level, lastLeft, obstacleIndex } = oldState | |
| const { right, up, down } = this._controls | |
| this._resetControls() | |
| let obstacleSpeed = INITIAL_OBSTACLE_STEP + INITIAL_OBSTACLE_STEP * (0.2) * level | |
| if (right) { | |
| obstacleSpeed *= 1 * 6 * Math.min(right, 2) | |
| } |
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
| _checkColision(playerLeft, playerTop, obstacleData, newLeft) { | |
| let isWithingHeight = false | |
| const wrapperHeight = this._wrapper.offsetHeight | |
| const obstacleHeight = wrapperHeight / 2 | |
| if (obstacleData.onTop) { | |
| if (playerTop <= obstacleHeight) { | |
| isWithingHeight = true | |
| } | |
| } else { | |
| if ((playerTop + PLAYER_HEIGHT) >= wrapperHeight - obstacleHeight) { |
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
| _listenToKey(ev) { | |
| if (ev.code === 'Enter') { | |
| if (!this.state.running) { | |
| this._startGame() | |
| } | |
| } | |
| if (this.state.running) { | |
| if (ev.code === 'Space' || ev.code === 'ArrowUp') { | |
| this._controls.up++ | |
| } |
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
| import React, { Component } from 'react'; | |
| import styled, {keyframes} from 'styled-components' | |
| const gentlyRock = keyframes` | |
| 0% {transform:rotate(4deg);} | |
| 50% {transform:rotate(-4deg);} | |
| 100% {transform:rotate(4deg);} | |
| ` | |
| const dead = keyframes` | |
| 0% {transform:rotate(0);} |
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
| import React, { Component } from 'react'; | |
| import styled from 'styled-components' | |
| const BackGround = styled.div` | |
| background-color: blue; | |
| width: 100%; | |
| height: 100%; | |
| overflow: hidden; | |
| position: absolute; | |
| text-align: center; | |
| ` |
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
| import React, { Component } from 'react'; | |
| export class BgMusic extends Component { | |
| render() { | |
| if (this.props.mute) { | |
| return null | |
| } | |
| if (this.props.gameOver) { | |
| return ( | |
| <audio |
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
| render() { | |
| return ( | |
| <div id="wrapper" ref={(c) => this._wrapper = c}> | |
| <BgMusic | |
| gameOver={this.state.gameOver} | |
| running={this.state.running} | |
| mute={this.state.mute} | |
| /> | |
| <Brackground |
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
| function sendMessage () { | |
| idleButton() | |
| var feedBack = document.getElementById('feedBack') | |
| var question = document.getElementById("question").value.trim() | |
| if (!question || question.length === 0){ | |
| setError('Insira uma pergunta') | |
| return | |
| } | |
| if (question === lastQuestion) { | |
| setError('Você já perguntou isso....') |
NewerOlder