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
| cy.get('form') | |
| .findByText('button', { name: /Button Text/i }) | |
| .should('exist') | |
| cy.findByRole('dialog').within(() => { | |
| cy.findByRole('button', { name: /confirm/i }) | |
| }) |
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
| var names = []; | |
| names[0] = prompt("New member name?"); | |
| localStorage.setItem("names", JSON.stringify(names)); | |
| //... | |
| var storedNames = JSON.parse(localStorage.getItem("names")); |
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
| for f in `ls *.md`; do | |
| pandoc -f markdown -t org -o ${f}.org ${f}; | |
| done |
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 { PhotoStory, VideoStory } from './stories'; | |
| const components = { | |
| photo: PhotoStory, | |
| video: VideoStory | |
| }; | |
| function Story(props) { | |
| // Correct! JSX type can be a capitalized variable. |
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 { Meta, Story, Preview } from "@storybook/addon-docs/blocks"; | |
| <Meta title="MDX/Sanitize" /> | |
| <Preview> | |
| <Story name="sanitize header"> | |
| <ce-sanitize html="<h1>Header</h1>"></ce-sanitize> | |
| </Story> | |
| </Preview> |
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
| componentDidUpdate(prevProps) { | |
| // 典型用法(不要忘记比较 props): | |
| if (this.props.userID !== prevProps.userID) { | |
| this.fetchData(this.props.userID); | |
| } | |
| } |
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
| class App extends React.Component { | |
| constructor() { | |
| super() | |
| this.state = { | |
| m: 0 | |
| } | |
| } | |
| static getDerivedStateFromProps(nextProps, prevState) { | |
| console.log("getDerived", nextProps, prevState); |
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
| - Edit the crontab file for the current user: | |
| crontab -e | |
| - View a list of existing cron jobs for current user: | |
| crontab -l | |
| - Remove all cron jobs for the current user: | |
| crontab -r |
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
| { | |
| ... | |
| "jest": { | |
| "coverageThreshold": { | |
| "global": { | |
| "branches": 50, | |
| "functions": 50, | |
| "lines": 50, | |
| "statements": 50 | |
| }, |
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
| "test": "react-scripts test -- --config=jest.config.js", |