Skip to content

Instantly share code, notes, and snippets.

View longfeixiang's full-sized avatar
🚀
报告,我只是浮肿

龙飞翔 longfeixiang

🚀
报告,我只是浮肿
  • dbappsecurity.com.cn
  • Nothing
View GitHub Profile
@longfeixiang
longfeixiang / t.js
Last active September 10, 2019 15:47
[oxfordlearnersdictionaries] 获取单词列表
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))
@longfeixiang
longfeixiang / a.css
Created August 7, 2019 08:05
[svg颜色填充] fill实现 #css #html
.svg {
fill: red;
}
@longfeixiang
longfeixiang / flex.css
Last active August 6, 2019 07:47
[flex:1; 造成的浏览器差异] .item { flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ] } #css
/* 语法: .item { flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ] } */
/* flex:1时,谷歌、火狐显示不一致,需要写成flex:1 1 auto; */
@longfeixiang
longfeixiang / r.js
Created August 5, 2019 09:58
[添加outline] 给页面所有元素随机颜色的outline #HTML
[].forEach.call($$("*"),function(a){ a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16) })
@longfeixiang
longfeixiang / ~.js
Created June 18, 2019 14:50
[按位非]
~new Date()
// -1796095878
@longfeixiang
longfeixiang / pnyn.html
Created June 5, 2019 02:05
[网页显示拼音] #HTML
<html>
<head>
<title>拼音</title>
</head>
<body>
<ruby>拼音<rt>pinyin</rt></ruby>
</body>
</html>
@longfeixiang
longfeixiang / isSorted.js
Created June 3, 2019 21:17
[是否是有序数组] #npm
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
})
}
@longfeixiang
longfeixiang / icons.scss
Last active May 31, 2019 17:57
[常用图标的css实现]
// 正方形
#square {
width: 100px;
height: 100px;
background: red;
}
// 长方形
#rectangle {
width: 200px;
@longfeixiang
longfeixiang / hasPathSum.js
Last active May 31, 2019 16:52
[检查二叉树是否存在一条路径] #编程题
// 问题:检查二叉树是否存在一条路径
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)
}