Skip to content

Instantly share code, notes, and snippets.

View JimmyLv's full-sized avatar
🎯
Focusing

JimmyLv_吕立青 JimmyLv

🎯
Focusing
View GitHub Profile
@JimmyLv
JimmyLv / 1611135231.js
Created January 20, 2021 09:33
Created with Copy to Gist
cy.get('form')
.findByText('button', { name: /Button Text/i })
.should('exist')
cy.findByRole('dialog').within(() => {
cy.findByRole('button', { name: /confirm/i })
})
@JimmyLv
JimmyLv / 1611064043.js
Created January 19, 2021 13:47
Created with Copy to Gist
var names = [];
names[0] = prompt("New member name?");
localStorage.setItem("names", JSON.stringify(names));
//...
var storedNames = JSON.parse(localStorage.getItem("names"));
@JimmyLv
JimmyLv / 1610697203.js
Created January 15, 2021 07:53
Created with Copy to Gist
for f in `ls *.md`; do
pandoc -f markdown -t org -o ${f}.org ${f};
done
@JimmyLv
JimmyLv / 1610690767.js
Created January 15, 2021 06:06
Created with Copy to Gist
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.
@JimmyLv
JimmyLv / 1610346248.js
Created January 11, 2021 06:24
Created with Copy to Gist
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>
@JimmyLv
JimmyLv / 1610021221.js
Created January 7, 2021 12:07
Created with Copy to Gist
componentDidUpdate(prevProps) {
// 典型用法(不要忘记比较 props):
if (this.props.userID !== prevProps.userID) {
this.fetchData(this.props.userID);
}
}
@JimmyLv
JimmyLv / 1610020510.js
Created January 7, 2021 11:55
Created with Copy to Gist
class App extends React.Component {
constructor() {
super()
this.state = {
m: 0
}
}
static getDerivedStateFromProps(nextProps, prevState) {
console.log("getDerived", nextProps, prevState);
- 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
@JimmyLv
JimmyLv / 1609982146.json
Created January 7, 2021 01:15
Created with Copy to Gist
{
...
"jest": {
"coverageThreshold": {
"global": {
"branches": 50,
"functions": 50,
"lines": 50,
"statements": 50
},
@JimmyLv
JimmyLv / 1609982017.js
Created January 7, 2021 01:13
Created with Copy to Gist
"test": "react-scripts test -- --config=jest.config.js",