async function loginController() {
try {
const a = await loginService().catch(error => {
throw new CustomErrorHandler({ code: 101, message: 'a failed', error: error });
});
const b = await someUtil().catch(error => {
throw new CustomErrorHandler({ code: 102, message: 'b failed', error: error });
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
module.exports = { | |
defaultBrowser: "Safari", | |
options: { | |
hideIcon: true, | |
}, | |
handlers: [ | |
{ | |
match: [ | |
/protopie\.atlassian\.net/, | |
/notion\.so\/protopie\/.*$/, |
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 { useCallback, useMemo, useState } from 'react'; | |
import { LOCAL_STORAGE_KEY } from '../constants'; | |
export function useLocalStorage<T extends object>(): { | |
parsedData: T; | |
loadLocalStorageData: () => Promise<T>; | |
setLocalStorageData: (data: T) => void; | |
clear: () => void; | |
} { | |
const [localStorageRawData, setLocalStorageRawData] = useState<string>('{}'); |
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
/* | |
* 아래에 있는 한글 폰트들은 아래 링크에서 받을 수 있습니다 | |
* | |
* 이롭게 바탕체 | |
* http://font.iropke.com/batang | |
* | |
* Source Han Serif | |
* https://source.typekit.com/source-han-serif/ | |
*/ |
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
/** | |
* 텍스트를 클립보드로 복사하는 역할을 수행해주는 인스턴스 생성 | |
* window 객체를 직접 주입하여 테스트 가능성 및 역할 명료화(불필요하면 나중에 삭제) | |
* reference: https://gist.github.com/rproenca/64781c6a1329b48a455b645d361a9aa3 | |
* | |
* 사용법: new Clipboard(window, document, navigator).copy('text'); | |
*/ | |
export default class Clipboard { | |
private textArea: HTMLTextAreaElement; | |
private document: Document; |
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
function Node(value = null, left = null, right = null) { | |
return { | |
value, | |
left, | |
right | |
} | |
} | |
const isEdgeLeaf = node => !node.left && !node.right | |
const getHeight = (node, height = 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
// Receive an Object, Return an Object Pattern (RORO) | |
// Reference: https://medium.freecodecamp.org/elegant-patterns-in-modern-javascript-roro-be01e7669cbd | |
type EventHandler = ({ type, event }: { type?: string, event?: any }) => void | |
type EventHandlerList = EventHandler[] | |
type EventHandlerMap = { | |
'*'?: EventHandlerList, | |
[type: string]: EventHandlerList | |
} |
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
function quickSort(arr) { | |
if (arr.length <= 1) return arr; | |
const result = []; | |
const pivot = arr[Math.floor(arr.length / 2)]; | |
const left = arr.filter(el => el < pivot); | |
const right = arr.filter(el => el > pivot); | |
return result.concat(quickSort(left), pivot, quickSort(right)); | |
} |
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
{ | |
"global": { | |
"check_for_updates_on_startup": true, | |
"show_in_menu_bar": false, | |
"show_profile_name_in_menu_bar": false | |
}, | |
"profiles": [ | |
{ | |
"complex_modifications": { | |
"parameters": { |
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
interface ICommand { | |
execute(): void; | |
} | |
class ConcreteCommander1 implements ICommand { | |
constructor(private receiver: Receiver) {} | |
execute(): void { | |
console.log("`execute` method of ConcreteCommand1 is being called!"); | |
this.receiver.action(); |
NewerOlder