Optional - Set format on save and any global prettier options
npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
type RemoveOn<T extends string> = T extends `on${infer R}` ? R : T; | |
type PropsFor<El extends keyof JSX.IntrinsicElements> = JSX.IntrinsicElements[El]; | |
type OnProps<El extends keyof JSX.IntrinsicElements> = Uncapitalize<RemoveOn<Extract<keyof PropsFor<El>, `on${string}`>>>; | |
type HandlerFor<El extends keyof JSX.IntrinsicElements, Ev extends OnProps<El>> = NonNullable<PropsFor<El>[`on${Capitalize<Ev>}` & keyof PropsFor<El>]>; | |
// Creating with a callback | |
function handlerFor<El extends keyof JSX.IntrinsicElements, Ev extends OnProps<El>>(event: [El, Ev], handler: HandlerFor<El, Ev>) { | |
return handler; | |
} |
'use strict'; | |
const b2Domain = ''; //你要在Cloudflare上綁定的Backblaze網域 | |
const b2Bucket = ''; //Backblaze B2的存儲桶名稱 | |
const b2UrlPath = `/file/${b2Bucket}/`; | |
addEventListener('fetch', event => { | |
return event.respondWith(fileReq(event)); | |
}); | |
// define the file extensions we wish to add basic access control headers to | |
const corsFileTypes = ['png', 'jpg', 'gif', 'jpeg', 'webp']; |
{ | |
"suggest.noselect": false, | |
"coc.preferences.formatOnSaveFiletypes": [ | |
"javascript", | |
"typescript", | |
"typescriptreact", | |
"json", | |
"javascriptreact", | |
"typescript.tsx", | |
"graphql" |
" Specify a directory for plugins | |
call plug#begin('~/.vim/plugged') | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'scrooloose/nerdtree' | |
"Plug 'tsony-tsonev/nerdtree-git-plugin' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'airblade/vim-gitgutter' |
import fs from 'fs'; | |
import path from 'path'; | |
/** | |
* Recursively walk a directory asynchronously and obtain all file names (with full path). | |
* | |
* @param dir Folder name you want to recursively process | |
* @param done Callback function, returns all files with full path. | |
* @param filter Optional filter to specify which files to include, | |
* e.g. for json files: (f: string) => /.json$/.test(f) |