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
import { | |
JSDOM | |
} from 'jsdom'; | |
import got from 'got'; | |
import iconv from 'iconv-lite' | |
const response = got({ | |
url: '........', | |
headers: { | |
'Content-Type': 'text/html; charset=utf-8' |
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
/** | |
* 从页面中提取文本,为什么不用 innerText/textContent ? | |
* 因为有些内容在 script/noscript/style 中,这些字符用户看不到,不能当成有意义字符。 | |
*/ | |
export const extractTextFromHTML = (window?: any) => { | |
if (!window) return '' | |
try { | |
const treeWalker = window.document.createTreeWalker( | |
window.document.body, |
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
#!/bin/bash | |
i=1 | |
for name in *.mp4; do | |
ffmpeg -i "$name" -vn "mp3/神探狄仁杰OST ${i%.*}.mp3" | |
let "i++" | |
done |
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
export default { | |
getUrlAllParam(...args) { | |
// 获取url参数的值,在hash路由的情况下,同时。适配参数在#前,和在#后的情况。 | |
if (args.length === 0) return undefined | |
const url = decodeURIComponent(window.location.href) | |
const reg = | |
args.length === 1 | |
? new RegExp(`[&?]${args[0]}=([^&%#]+)`) | |
: new RegExp(`[&?](?:${args.join('|')})=([^&%#]+)`) |
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
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
var htmlEscaper = strings.NewReplacer( | |
"#", "\\#", |
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
配置 Prettier 规则的地方有好几个,比如可以在 `.vscode/settings.json` 里,也可在项目根目录下的 `.prettierrc`文件里,但如果后者存在(就算空白没东西), | |
那么 Prettier 将不会尝试从 settings.json 里读取任何配置。 | |
P.S. 这不是前者覆盖后者的关系。是如果有这个配置文件,另一个就没用的关系。 |
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
用到这个库:https://github.com/gre/bezier-easing | |
`bezier-easing` 和 CSS 的 `transition-timing-function` 函数效果完全一样 | |
``` | |
import BezierEasing from "bezier-easing"; | |
TweenLite.to(mc, 5, {x:600, ease:new Ease(BezierEasing(0.25, 0.1, 0.0, 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
// 配置翻墙用的Client | |
// socks5://127.0.0.1:1085 | |
func createProxyClient(socks5 string) *http.Client { | |
client := &http.Client{} | |
tgProxyURL, err := url.Parse(socks5) | |
if err != nil { | |
fmt.Printf("解析socks5失败: %s", err.Error()) | |
os.Exit(1) | |
} |
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
- name: 更新为中国时间 | |
run: | | |
sudo rm -rf /etc/localtime | |
sudo ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
date |
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
项目A引用了模块B, | |
模块B引用了模块C, | |
如果想replace C到本地的文件,那么不能在模块B的`go.mod`中写,而是要写在项目A的`go.mod`中。 |
NewerOlder