难度:★
var data = [
{
name: "Jamestown",
population: 2047,
temperatures: [-34, 67, 101, 87]
},
{ | |
"type": "excalidraw", | |
"version": 2, | |
"source": "https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/2.12.2", | |
"elements": [ | |
{ | |
"id": "xa_8W5YVBydoyZ_JhIb7J", | |
"type": "rectangle", | |
"x": -250.38674277905739, | |
"y": -173.59524536132812, |
//Help me to write a javascript function that download my investment data from a website. | |
// What the function need to do is parse the HTML of the page and extract the investment data. | |
// The description of the DOM structure: | |
// the title row's select is .PositionList_listTitle, then the col name defined under the span in the class ListItemView_commonBox, need to ignore .ListItemView_detailExtra | |
// the data row's select is ListItemView, but it is just a wrapper. the value of each cols is in .ListItemView_commonBox, but .ListItemView_commonBox may not | |
// the direct child of the row, it may exists some nest structure. | |
// If you find the .ListItemView_commonBox, then you can find the text in the span, but sometimes there are some nested spans. | |
// let's me give you some example: |
[ | |
{ | |
"name": "Personal Email", | |
"text": "[email protected]", | |
"keyword": "@@" | |
}, | |
{ | |
"name": "Home Address", | |
"text": "221B Baker St., London" | |
}, |
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. | |
# Initialization code that may require console input (password prompts, [y/n] | |
# confirmations, etc.) must go above this block; everything else may go below. | |
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | |
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | |
fi | |
# If you come from bash you might have to change your $PATH. | |
export PATH=$HOME/bin:/usr/local/bin:$PATH |
console.group('output 🌿') | |
queueMicrotask(() => { | |
console.log('queueMicrotask') | |
}); | |
requestAnimationFrame(() => { | |
console.log('requestAnimationFrame') | |
}) |
import { | |
SyncHook, | |
SyncBailHook, | |
SyncWaterfallHook, | |
SyncLoopHook, | |
AsyncParallelHook, | |
AsyncParallelBailHook, | |
AsyncSeriesHook, | |
AsyncSeriesBailHook, | |
AsyncSeriesWaterfallHook, |
function consoleSplit(description = '') { | |
console.log('-'.repeat(25) + description + '-'.repeat(25)); | |
} | |
consoleSplit('Get, Set, Has, DeleteProperty') | |
const p1 = { | |
name: 'rio', | |
age: 20, | |
} |
/** | |
* html-to-rtf-browser not recognize height/style property of img tag | |
* so, need add height/size to style property to avoid image lose rtf picture size. | |
*/ | |
function attachDimensionStyleForImage(htmlString: string): string { | |
try { | |
const domParser = new DOMParser(); | |
const doc = domParser.parseFromString(htmlString, "text/html"); | |
const images = doc.getElementsByTagName("img"); | |
for (let i = 0; i < images.length; i++) { |
import { useEffect } from "react"; | |
import { useHistory } from "react-router-dom"; | |
export const defaultLevelMessage = | |
"未保存のデータがあります。ページを離れてもよろしいですか。"; | |
function useBlockRouteChange( | |
shouldBlock: boolean, | |
message = defaultLevelMessage, | |
onLevel?: () => void |