Skip to content

Instantly share code, notes, and snippets.

Avatar

Chang-Hsi Hsieh Isaddo

View GitHub Profile
@Isaddo
Isaddo / mobileBarcodeValidator.js
Last active Sep 8, 2020
用 regular expression 驗證電子發票手機條碼格式 。E-invoice mobile barcode validator by regular expression.
View mobileBarcodeValidator.js
/*
* 第 1 碼為 /
* 其餘 7 碼為 0-9 A-Z . - +
*/
module.exports = (value) => {
// - 需放最後,不然要會跟 0-9 的 - 混淆
const patt = /^\/[0-9A-Z.+-]{7}$/
if (patt.test(value)) return null
@Isaddo
Isaddo / chrome_hotkeys.md
Last active Mar 8, 2021
Useful Hotkeys of Windows and Chrome
View chrome_hotkeys.md

Chrome Useful Hotkeys

  • Ctrl Tab 切換分頁
  • Ctrl Shift B 開關書籤列
  • Ctrl Shift O 書籤管理員
  • 在網址列用搜尋方式開啟「書籤」「常用網頁」
  • Alt Shift TCtrl Enter focus 到上一頁按鈕 >開在新分頁
  • Alt DAlt Enter 開一樣的網址分頁
View excel_hotkeys.md

Excel Useful Hotkeys

Cell

  • delete cell
    • ctrl -
    • altED Edit Delete (2003)
    • altHDD Home Delete Delete
  • clear cell
    • altEAA Edit cleAr All (2003)
    • altEAF Edit cleAr Format (2003)
View splitUpdater.js
import memoize from 'lodash/memoize'
function isNil (value) {
return value === undefined || value === null
}
function sallowCopy (obj) {
return Array.isArray(obj) ? [...obj] : { ...obj }
}
function toUpdateFunc (input) {
View UnpivotWithExcel.mkd

Unpivot With Excel

Alt+DP C N I N (選範圍) Enter Enter

  1. Alt+D P 開啟舊的 pivote table wizard
  2. 選「多重彙總資料範圍」 -> 下一步
  3. 「我會自行建立分頁欄位」 -> 下一步
  4. 選擇 Table 範圍 -> 下一步 -> 完成
  5. 集中做完 unpivot 的資料
@Isaddo
Isaddo / walkDirSync.js
Created Nov 3, 2016
Get all file paths in a directory recursively
View walkDirSync.js
const path = require('path')
const fs = require('fs')
function walkDirSync (dir) {
return fs.readdirSync(dir).reduce((filePaths, fileName) => {
const filePath = path.join(dir, fileName)
if (fs.statSync(filePath).isDirectory()) {
return filePaths.concat(walkDirSync(filePath))
}
@Isaddo
Isaddo / import-github-labels.js
Last active Jul 22, 2021
import github labels via console command
View import-github-labels.js
/*
Go on your labels page (https://github.com/user/repo/labels)
Edit the following label array
or
Use this snippet to export github labels (https://gist.github.com/MoOx/93c2853fee760f42d97f)
and replace it
Paste this script in your console
Press Enter!!