created: [2020-05-31]
- Version control gists?
- Modify gists from CLI or IDE
| import React from "react"; | |
| import ReactDOM from "react-dom"; | |
| import "./index.css"; | |
| function Square(props) { | |
| return ( | |
| <button className="square" onClick={props.onClick}> | |
| {props.value} | |
| </button> | |
| ); |
| // condensed preview | |
| class Game extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| history: [ | |
| { | |
| squares: Array(9).fill(null) | |
| } |
| function Square(props) { | |
| return ( | |
| <button | |
| className={"square " + (props.isWinning ? "square--winning" : null)} | |
| onClick={props.onClick} | |
| > | |
| {props.value} | |
| </button> | |
| ); | |
| } |
| class Board extends React.Component { | |
| renderSquare(i) { | |
| return ( | |
| <Square | |
| isWinning={this.props.winningSquares.includes(i)} | |
| key={"square " + i} | |
| value={this.props.squares[i]} | |
| onClick={() => this.props.onClick(i)} | |
| /> | |
| ); |
| import React from "react"; | |
| import ReactDOM from "react-dom"; | |
| import "./index.css"; | |
| function Square(props) { | |
| return ( | |
| <button | |
| className={"square " + (props.isWinning ? "square--winning" : null)} | |
| onClick={props.onClick} | |
| > |
| // inside Game component's render() call | |
| let status; | |
| if (winner) { | |
| status = "Winner: " + winner.player + " @ " + winner.line; | |
| } else if (!current.squares.includes(null)) { | |
| status = "draw"; | |
| } else { | |
| status = "Next player: " + (this.state.xIsNext ? "X" : "O"); | |
| } |
| import React from "react"; | |
| import ReactDOM from "react-dom"; | |
| import "./index.css"; | |
| function Square(props) { | |
| return ( | |
| <button | |
| className={"square " + (props.isWinning ? "square--winning" : null)} | |
| onClick={props.onClick} | |
| > |
| // ---------------------------------------------------------- | |
| // https://lowlvl.org/tcp-ip-fundamentals/exchanging-messages | |
| // ---------------------------------------------------------- | |
| // Write your code here. | |
| let socket = UdpSocket::bind("10.0.0.1:1000").expect("couldn't bind to address"); | |
| // SEND TO NAME SERVER | |
| socket | |
| .send_to(b"Alice", "1.2.3.4:53") |
| {"requestedUrl":"https://thekevinwang.com/","finalUrl":"https://thekevinwang.com/","lighthouseVersion":"9.0.0","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/95.0.4638.69 Safari/537.36","fetchTime":"2021-11-20T19:53:59.857Z","environment":{"networkUserAgent":"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4695.0 Mobile Safari/537.36 Chrome-Lighthouse","hostUserAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/95.0.4638.69 Safari/537.36","benchmarkIndex":1147.5},"runWarnings":[],"configSettings":{"emulatedFormFactor":"mobile","formFactor":"mobile","locale":"en-US","onlyCategories":["performance","accessibility","best-practices","seo"],"channel":"lr"},"audits":{"dom-size":{"id":"dom-size","title":"Avoids an excessive DOM size","description":"A large DOM will increase memory usage, cause longer [style calculations](https://developers.google.com/web/fundamentals/performa |