react
This commit is contained in:
21
JavaScript/React/tic-tac-toe/.gitignore
vendored
Normal file
21
JavaScript/React/tic-tac-toe/.gitignore
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
2444
JavaScript/React/tic-tac-toe/README.md
Normal file
2444
JavaScript/React/tic-tac-toe/README.md
Normal file
File diff suppressed because it is too large
Load Diff
11269
JavaScript/React/tic-tac-toe/package-lock.json
generated
Normal file
11269
JavaScript/React/tic-tac-toe/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
16
JavaScript/React/tic-tac-toe/package.json
Normal file
16
JavaScript/React/tic-tac-toe/package.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "tic-tac-toe",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"react": "^16.4.2",
|
||||
"react-dom": "^16.4.2",
|
||||
"react-scripts": "1.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test --env=jsdom",
|
||||
"eject": "react-scripts eject"
|
||||
}
|
||||
}
|
||||
BIN
JavaScript/React/tic-tac-toe/public/favicon.ico
Normal file
BIN
JavaScript/React/tic-tac-toe/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
40
JavaScript/React/tic-tac-toe/public/index.html
Normal file
40
JavaScript/React/tic-tac-toe/public/index.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is added to the
|
||||
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
|
||||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
You need to enable JavaScript to run this app.
|
||||
</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
15
JavaScript/React/tic-tac-toe/public/manifest.json
Normal file
15
JavaScript/React/tic-tac-toe/public/manifest.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
}
|
||||
],
|
||||
"start_url": "./index.html",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
50
JavaScript/React/tic-tac-toe/src/index.css
Normal file
50
JavaScript/React/tic-tac-toe/src/index.css
Normal file
@@ -0,0 +1,50 @@
|
||||
body {
|
||||
font: 14px "Century Gothic", Futura, sans-serif;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
ol, ul {
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
.board-row:after {
|
||||
clear: both;
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.status {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.square {
|
||||
background: #fff;
|
||||
border: 1px solid #999;
|
||||
float: left;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
line-height: 34px;
|
||||
height: 34px;
|
||||
margin-right: -1px;
|
||||
margin-top: -1px;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
width: 34px;
|
||||
}
|
||||
|
||||
.square:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.kbd-navigation .square:focus {
|
||||
background: #ddd;
|
||||
}
|
||||
|
||||
.game {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.game-info {
|
||||
margin-left: 20px;
|
||||
}
|
||||
72
JavaScript/React/tic-tac-toe/src/index.js
Normal file
72
JavaScript/React/tic-tac-toe/src/index.js
Normal file
@@ -0,0 +1,72 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
|
||||
class Square extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
value: null
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<button className="square" onClick={() => this.setState({value: 'X'})}>
|
||||
{this.state.value}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Board extends React.Component {
|
||||
renderSquare(i) {
|
||||
return <Square value={i}/>;
|
||||
}
|
||||
|
||||
render() {
|
||||
const status = 'Next player: X';
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="status">{status}</div>
|
||||
<div className="board-row">
|
||||
{this.renderSquare(0)}
|
||||
{this.renderSquare(1)}
|
||||
{this.renderSquare(2)}
|
||||
</div>
|
||||
<div className="board-row">
|
||||
{this.renderSquare(3)}
|
||||
{this.renderSquare(4)}
|
||||
{this.renderSquare(5)}
|
||||
</div>
|
||||
<div className="board-row">
|
||||
{this.renderSquare(6)}
|
||||
{this.renderSquare(7)}
|
||||
{this.renderSquare(8)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Game extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div className="game">
|
||||
<div className="game-board">
|
||||
<Board />
|
||||
</div>
|
||||
<div className="game-info">
|
||||
<div>{/* status */}</div>
|
||||
<ol>{/* TODO */}</ol>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Game />,
|
||||
document.getElementById('root')
|
||||
);
|
||||
9
JavaScript/javascript safe/.vscode/settings.json
vendored
Normal file
9
JavaScript/javascript safe/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"spellright.language": "en",
|
||||
"spellright.documentTypes": [
|
||||
"markdown",
|
||||
"latex",
|
||||
"plaintext",
|
||||
"html"
|
||||
]
|
||||
}
|
||||
30
JavaScript/javascript safe/index.html
Normal file
30
JavaScript/javascript safe/index.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Professional data safe</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
x = () => {
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
check = (a) => {
|
||||
localStorage.content = "pwwd24ctf189HIhi"
|
||||
k = document.getElementById("keyhole");
|
||||
a = document.getElementById("access");
|
||||
if (!x(k.value)) return a.innerHTML = "access denied"
|
||||
a.innerHTML = "access granted"
|
||||
password = Array.from(k.value).map(c => c.charCodeAt());
|
||||
encrypted = localStorage.content || '';
|
||||
content = encrypted.map((c, x) => c ^ password[i % k.value.length]).map(String.fromCharCode).join('');
|
||||
}
|
||||
</script>
|
||||
password: <input id="keyhole" type="text" autofocus onchange="check()" placeholder="🔑">
|
||||
<div id="access"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user