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 from 'react | |
import useUserContext from './use-user-context' | |
import { routerRegister } from './route-register' | |
const App = () => { | |
const userContext = useUserContext() | |
return routeRegister.reduce((routes, route) => { | |
if (route.predicate(userContext)) { | |
routes.push(<Route path={route.path} exact={route.isExact} component={route.Component} key={route.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
#include <stdio.h> | |
#include <time.h> | |
#define TRUE 1 | |
#define FALSE 0 | |
int main ( int argc, char * argv [] ) | |
{ | |
clock_t begin = clock(); | |
long minValue = 278384; |
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 {JSDOM} from 'jsdom'; | |
const {document} = (new JSDOM(`<body></body>`)).window; | |
global.document = document; | |
// map | |
const map = global.document.createElement(`div`); | |
map.setAttribute(`id`, `map`); | |
global.document.body.appendChild(map); |
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
#!/usr/bin/env node | |
const {exec} = require('child_process'); | |
exec('npm bin', {cwd: __dirname}, (err, stdout, stderr) => { | |
exec(`rm ${process.cwd()}/src/App.css ${process.cwd()}/src/App.test.js ${process.cwd()}/src/index.css ${process.cwd()}/src/logo.svg ${process.cwd()}/src/serviceWorker.js ${process.cwd()}/src/index.js ${process.cwd()}/src/App.js && echo "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './App';\nReactDOM.render(<App />, document.getElementById('root'));" > ${process.cwd()}/src/index.js && echo "import React, { Component } from 'react';\nclass App extends Component {\n render() {\n return (\n <h1>Hello World</h1>\n );\n }\n}\nexport default App;" > ${process.cwd()}/src/App.js`, {cwd: __dirname}, (err, stdout, stderr) => { | |
if (err) { | |
console.error(err); | |
} else { | |
console.log('🚀'); |