Skip to content

Instantly share code, notes, and snippets.

View Isaddo's full-sized avatar

Charles Hsieh Isaddo

View GitHub Profile
@Isaddo
Isaddo / mobileBarcodeValidator.js
Last active November 24, 2022 07:44
用 regular expression 驗證電子發票手機條碼格式 。E-invoice mobile barcode validator by regular expression.
/*
* 第 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 October 22, 2023 22:23
Useful Hotkeys of Windows and Chrome

Chrome Useful Hotkeys

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

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)
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) {

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 November 3, 2016 05:20
Get all file paths in a directory recursively
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 February 9, 2024 22:44
import github labels via console command
/*
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!!