This file contains 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
const r = [] | |
$('.top-g li').each((i, k) => { | |
// {hw: "a", ox3000: "a1", ox5000: "a1"} | |
if ($(k).hasClass('hidden')) { return } | |
const word = $(k).attr('data-hw') | |
const level = $(k).attr('data-ox3000') | |
r.push({ word, level }) | |
}) | |
console.log(JSON.stringify(r, null, 2)) |
This file contains 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
.svg { | |
fill: red; | |
} |
This file contains 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
/* 语法: .item { flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ] } */ | |
/* flex:1时,谷歌、火狐显示不一致,需要写成flex:1 1 auto; */ |
This file contains 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
[].forEach.call($$("*"),function(a){ a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16) }) |
This file contains 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
~new Date() | |
// -1796095878 |
This file contains 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
<html> | |
<head> | |
<title>拼音</title> | |
</head> | |
<body> | |
<ruby>拼音<rt>pinyin</rt></ruby> | |
</body> | |
</html> |
This file contains 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
const defaultComparator = (a, b) => a - b | |
const checkSort = (array, comparator = defaultComparator) => { | |
if (!Array.isArray(array)) { | |
throw new TypeError('Expected Array, got ' + (typeof array)) | |
} | |
return array.length <= 1 || array.some((k, i) => { | |
return comparator(k, array[i - 1]) > 0 | |
}) | |
} |
This file contains 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
// 正方形 | |
#square { | |
width: 100px; | |
height: 100px; | |
background: red; | |
} | |
// 长方形 | |
#rectangle { | |
width: 200px; |
This file contains 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
// 问题:检查二叉树是否存在一条路径 | |
const hasPathSum = (root, sum) => { | |
// console.count('%s run', this.name) | |
if (!root || root.value > sum) { | |
return false | |
} else if (root.value === sum) { | |
return true | |
} | |
return hasPathSum(root.left, sum - root.value) || hasPathSum(root.right, sum - root.value) | |
} |