Skip to content

Instantly share code, notes, and snippets.

View JimmyLv's full-sized avatar
🎯
Focusing

JimmyLv_吕立青 JimmyLv

🎯
Focusing
View GitHub Profile
@JimmyLv
JimmyLv / 1609981421.js
Created January 7, 2021 01:03
Created with Copy to Gist
class EmailInput extends Component {
state = {
email: this.props.defaultEmail,
prevPropsUserID: this.props.userID
};
static getDerivedStateFromProps(props, state) {
// Any time the current user changes,
// Reset any parts of state that are tied to that user.
// In this simple example, that's just the email.
@JimmyLv
JimmyLv / 1609917411.js
Created January 6, 2021 07:16
Created with Copy to Gist
const user = {
id: 1,
name: 'Hugo',
friends: [3, 5, 22]
};
test('user 3 should be a friend of user', () => {
expect(user).toEqual(
expect.objectContaining({
friends: expect.arrayContaining([3])
})
@JimmyLv
JimmyLv / 1609917271.js
Created January 6, 2021 07:14
Created with Copy to Gist
test('id and productName should match', () => {
const obj = {
id: '111',
productName: 'Jest Handbook',
url: 'https://jesthandbook.com'
};
expect(obj).toEqual(
expect.objectContaining({
id: '111',
productName: 'Jest Handbook'
@JimmyLv
JimmyLv / 1609916825.js
Created January 6, 2021 07:07
Created with Copy to Gist
describe('contains test', () => {
it('should return true', () => {
const arr = [ { a: 1 }, { b: 2 }, { c: 3 } ]
expect(arr).toContainEqual( // Compare values only.
{ b: 2 }
)
})
})
@JimmyLv
JimmyLv / twitter-auto-translator.js
Created December 14, 2020 12:44
Twitter Auto Translator
// ==UserScript==
// @name Twitter Auto Translator
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://twitter.com/*
// @grant none
// ==/UserScript==
@JimmyLv
JimmyLv / 1606814450.js
Created December 1, 2020 09:20
Created with Copy to Gist
Shoplooks is an exclusive
integrated marketing agency
for bloggers, influencers
And content creators sharing what they love and helping the world's
best brands reach new audiences and enhance awareness.
@JimmyLv
JimmyLv / 1606814407.js
Created December 1, 2020 09:20
Created with Copy to Gist
Foci https://click.shoplooks.com/4mmh/61
苹果手表6代(银40+铝合金+白单圈表带3号)https://click.shoplooks.com/45C4/61
const [value, setValue] = useState(0)
function App() {
const [todos, setTodos] = useState([
{ id: 1, title: "Selectus aut autem", completed: false },
{ id: 2, title: "Luis ut nam facilis et officia qui", completed: false },
{ id: 3, title: "Fugiat veniam minus", completed: false },
{ id: 4, title: "Aet porro tempora", completed: true },
{ id: 5, title: "Laboriosam mollitia et enim quasi", completed: false }
]);
@JimmyLv
JimmyLv / cardify.js
Created November 21, 2020 08:46
直接通过 import URL 的方式导入模块
import { React, ReactDOM } from "https://unpkg.com/es-react@16"
import htm from "https://unpkg.com/htm?module"
const html = htm.bind(React.createElement)