Read only staged files (git add) and ignore unstaged changes. Generate a Conventional Commits–compliant commit message based on the staged diff.
Format:
<type>(optional scope): <summary>
- <bullet 1>
- <bullet 2>
-
Read only staged files (git add) and ignore unstaged changes. Generate a Conventional Commits–compliant commit message based on the staged diff.
Format:
<type>(optional scope): <summary>
- <bullet 1>
- <bullet 2>
-
| // https://mihomo.party/docs/guide/override/javascript | |
| function main(config) { | |
| // 创建一个新的代理组 | |
| const jpProxies = []; | |
| const regx = /(日本|川日|东京|大阪|泉日|埼玉|沪日|深日|JP|Japan)/i; | |
| // 遍历所有代理,检查名称是否以 "Japan-" 开头 | |
| config.proxies.forEach(proxy => { | |
| if (proxy.name && regx.test(proxy.name)) { | |
| jpProxies.push(proxy.name); // 将符合条件的代理加入 JP 组 |
| /** | |
| * 获取一个数字的小数部分,如果是整数则返回 0 | |
| */ | |
| function getDecimal(num: number): number { | |
| // 原理是先将数字乘以一定倍速,作为整数来计算 | |
| // 具体乘多大视乎小数点后有多少位 (10为基数的 x 次幂) | |
| const BASE = Math.pow(10, (num.toString().split('.')[1] || '').length); | |
| return num * BASE % BASE / BASE; | |
| } |
| // 比如 API 暴露 | |
| function useApi () { | |
| const a = 'a' | |
| const b = 'b' | |
| const c = 'c' | |
| return Object.assign([ a, b, c ], { a, b, c }) // 务必数组在前,否则无法维护下标 | |
| } | |
| // 使用时既可以 | |
| const [ a, b, c ] = useApi() // react hook 风格的数组解构 |
| // 传统写法 | |
| const el = document.createElement('link') | |
| el.rel = 'stylesheet' | |
| el.href = 'main.css' | |
| document.head.appendChild(el) | |
| // 单条写法 | |
| document.head.appendChild(Object.assign( | |
| document.createElement('link'), | |
| { rel: 'stylesheet', href: 'main.css' }, |
| { | |
| "createdBy": "Redirector v3.1.0", | |
| "createdAt": "2018-05-30T05:26:18.152Z", | |
| "redirects": [ | |
| { | |
| "description": "cdnjs.cloudflare.com", | |
| "exampleUrl": "https://cdnjs.cloudflare.com/foo", | |
| "exampleResult": "https://cdnjs.loli.net/foo", | |
| "error": null, | |
| "includePattern": "*//cdnjs.cloudflare.com/*", |
| javascript:void(function(url, script) { | |
| script = document.body.appendChild(document.createElement('script')); | |
| script.src = url; | |
| script.onload = function() {pangu.spacingPage()}; | |
| }('//cdn.bootcss.com/pangu/3.2.1/pangu.min.js')) |
| var ipStr = '180.97.33.107' | |
| var arr = ipStr.split('.').map((el => parseInt(el, 10))) | |
| // 十进制 | |
| var ten = arr[0] * Math.pow(2, 24) + arr[1] * Math.pow(2, 16) + arr[2] * Math.pow(2, 8) + arr[3] | |
| console.log('http://' + ten) | |
| // 十六进制 | |
| var sixteen = ten.toString(16) |
| var page = require('webpage').create(); | |
| var url = 'http://ukn.me/#!/post/2016-07-13-Array%2520%25E9%259B%2586%25E5%2590%2588%25E6%2596%25B9%25E6%25B3%2595.md'; | |
| // 视窗大小 | |
| page.viewportSize = { | |
| width: 1440, | |
| height: 900 | |
| } |