Skip to content

Instantly share code, notes, and snippets.

View Jonghakseo's full-sized avatar
๐Ÿ•ถ๏ธ
be good

JongHak Seo Jonghakseo

๐Ÿ•ถ๏ธ
be good
View GitHub Profile
@Jonghakseo
Jonghakseo / zendesk.js
Created January 13, 2025 02:11
Zendesk chatbot sdk AI๋กœ ๋‚œ๋…ํ™” ์ œ๊ฑฐ
(() => {
// Module definitions
var moduleCache,
moduleExports,
moduleDefinitions = {
271: (module) => {
function getQueryParamsString(url) {
const link = document.createElement('a');
link.href = url;
return link.search.split('?').at(1) || '';
@Jonghakseo
Jonghakseo / syncStoreWithURL.ts
Last active November 23, 2024 04:47
Zustand sync with querystring (for SPA)
import type { StoreApi } from 'zustand/vanilla';
type RemoveFunctionFromObject<T> = {
[key in keyof T as T[key] extends Function ? never : key]: T[key];
};
type CustomSerializeDeserialize<Value> = {
serialize?: (value: Value) => string;
deserialize?: (value: string) => Value;
};
https://excalidraw.com/#json=MerJRiKt49ryTnFFYJIR-,ZZzylocjGjAPkzuJ3_lO3Q

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2023-11-26 แ„‹แ…ฉแ„Œแ…ฅแ†ซ 1.19.38.png

์—๋Ÿฌ ์ •์ฑ…์„ ignore๋กœ ํ–ˆ์„ ๋•Œ์—๋„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒ. onError๊ฐ€ ์‹คํ–‰๋จ์„ ํ™•์ธ

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2023-11-26 แ„‹แ…ฉแ„Œแ…ฅแ†ซ 1.19.43.png

onError๋ฅผ ๋„ฃ์–ด์ฃผ์ง€ ์•Š์œผ๋ฉด,

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2023-11-26 แ„‹แ…ฉแ„Œแ…ฅแ†ซ 1.19.54.png

์–ดํ•™๋‹น ์ฑ—๋ด‡ Proof of Concept

์•„์ด๋””์–ด

  1. openai์—์„œ ๊ณต๊ฐœํ•œ chatgpt api๋Š” ์ตœ๋Œ€ ์š”์ฒญ ๊ฐ€๋Šฅ ํ…์ŠคํŠธ์˜ ๊ธธ์ด๊ฐ€ ์ •ํ•ด์ ธ ์žˆ์Œ (max_token: 4096ํ† ํฐ: ์•ฝ 3000 ๋‹จ์–ด)
  2. ๊ทธ๋Ÿฐ๋ฐ chatpdf.com ๋“ฑ์˜ ์„œ๋น„์Šค๋ฅผ ๋ณด๋ฉด, ๋Œ€์šฉ๋Ÿ‰์˜ pdf๋ฌธ์„œ๋ฅผ ์ž…๋ ฅํ•œ ์ƒํƒœ์—์„œ ๋‚ด์šฉ์„ ์š”์•ฝํ•ด์ฃผ๋Š” ๋ชจ์Šต์„ ๋ณผ ์ˆ˜ ์žˆ์Œ
  3. max_token ์ œํ•œ์„ ์–ด๋–ป๊ฒŒ ์šฐํšŒํ•œ ๊ฒƒ์ธ์ง€ ์ฐพ์•„๋ณด๊ธฐ ์‹œ์ž‘
  4. text embedding ์„ ํ†ตํ•ด ChatGPT์—๊ฒŒ ์งˆ๋ฌธ ํ•  ๋•Œ, ๊ด€๋ จ ์ปจํ…์ŠคํŠธ๋ฅผ ๊ฐ™์ด ๋ณด๋‚ด์ค€๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๊ฒŒ ๋จ
  5. chatgpt์— ์ œ๊ณตํ•  ์ˆ˜ ์žˆ๋Š” ์ปจํ…์ŠคํŠธ๊ฐ€ ์‚ฌ์‹ค์ƒ ๋ฌด์ œํ•œ์œผ๋กœ ๋Š˜์–ด๋‚œ๋‹ค๋Š” ์‚ฌ์‹ค์„ ์•Œ๊ฒŒ ๋˜์—ˆ์Œ
  6. ์‚ฌ๋‚ด ํ’๋ถ€ํ•œ ์ปจํ…์ธ ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ chatbot ์„œ๋น„์Šค๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™๋‹ค๋Š” ์ƒ๊ฐ์„ ํ•จ
@Jonghakseo
Jonghakseo / graphql-codegen_์ด์Šˆ.md
Last active March 17, 2023 11:16
์ด์Šˆ์ด์Šˆ

๋ฐœ๋‹จ

creatrip-web ๋ ˆํฌ ์ตœ์ƒ์œ„ ํด๋”์— ์žˆ๋Š” stay๋ฅผ packages/stay/app ํ•˜์œ„๋กœ ์ •๋ฆฌํ•˜๊ธฐ๋กœ ํ•จ

๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ˆœ์„œ๋กœ ์ง„ํ–‰

  1. packages/stay/app ํด๋” ์ƒ์„ฑ
  2. stay ํด๋” ๋‚ด์šฉ ํ†ต์งธ๋กœ packages/stay/app ๋‚ด๋ถ€๋กœ ์ด๋™
  3. npm init -w ./packages/stay/app ์œผ๋กœ npm workspace ์ƒ์„ฑ
  4. ํŒจํ‚ค์ง€ ์ด๋ฆ„ @creatrip-stay/app ์œผ๋กœ ์ƒ์„ฑ
  5. npm install => node_modules์— @creatrip-stay/app symlink ์ƒ์„ฑ
  6. npm run re-codegen

getByRole('listitem', { name: "" }) ์‚ฌ์šฉ์ด ๋ถˆ๊ฐ€๋Šฅํ•œ ์ด์œ 

์ €ํฌ๊ฐ€ ์‚ฌ์šฉํ•˜๋Š” react-testing-library์˜ ๊ฒฝ์šฐ ์ ‘๊ทผ์„ฑ ํŠธ๋ฆฌ๋ฅผ ํ™œ์šฉํ•œ ํ…Œ์ŠคํŠธ๋ฅผ ์ง€์›ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ํŠนํžˆ ์˜ต์…˜์— name์„ ๋„ฃ์–ด์ฃผ๋ฉด ์ ‘๊ทผ ๊ฐ€๋Šฅํ•œ ์ด๋ฆ„์„ ๊ณ„์‚ฐํ•˜์—ฌ ์ •ํ™•ํ•œ ์š”์†Œ๋ฅผ ์ฐพ๋Š”๋ฐ ๋„์›€์„ ์ค๋‹ˆ๋‹ค.

์ฐธ๊ณ ๋กœ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•œ ์ด๋ฆ„์„ ์ฐพ๊ธฐ ์œ„ํ•ด์„œ ์‚ฌ์šฉ๋˜๋Š” ๋กœ์ง์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. Accessible Name and Description Computation

getByRole('listitem', { name: "~" } )

FireEvent -> UserEvent ๋ณ€๊ฒฝ์‹œ FailCase

๊ธฐ์กด fireEvent ๋ฉ”์†Œ๋“œ๋กœ ํ˜ธ์ถœํ•˜๋˜ ๋ถ€๋ถ„์„ userEvent๋กœ ๋ณ€๊ฒฝํ•˜๋ฉด์„œ ์‹คํŒจ๊ฐ€ ๋˜๋Š” ์ผ€์ด์Šค ์›์ธ ๋ถ„์„

  • ๊ตญ๊ฐ€ ์ฝ”๋“œ ์„ ํƒ(select)์™€ input์ด ๊ฐ™์€ label ํƒœ๊ทธ ์•ˆ์— ์กด์žฌํ•˜๋Š” ๊ฒฝ์šฐ (ex. ProxyShopOrderRecipientInfoField.test.tsx) userEvent.type(phoneNumberInput, value) -> ๋™์ž‘ํ•˜์ง€ ์•Š๋Š” ๋ฌธ์ œ ๋ฐœ์ƒ

userEvent์˜ type๋ฉ”์†Œ๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ๋ฆ„์œผ๋กœ ์ฒ˜๋ฆฌ

  1. element(ํƒ€์ดํ•‘์„ ํ•˜๋ ค๋Š” element)๊ฐ€ disable์ธ์ง€ ํ™•์ธ
  2. element ํด๋ฆญ

RTL ๋ฉ”์†Œ๋“œ ์ค‘ ByRole ์ž‘๋™๋ฐฉ์‹์— ๋Œ€ํ•ด์„œ...

  • RTL์—์„œ ์ œ๊ณตํ•˜๋Š” ByRole ๋ฉ”์†Œ๋“œ(getByRole, queryByRole, findByRole...)๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ์ ‘๊ทผ์„ฑ ํŠธ๋ฆฌ๋ฅผ ํ™œ์šฉํ•œ ์š”์†Œ ์ ‘๊ทผ ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์ €ํฌ๊ฐ€ ์‚ฌ์šฉํ•˜๋Š” getByRole ๋ฉ”์†Œ๋“œ์˜ ๊ฒฝ์šฐ, ์ฒซ ๋ฒˆ์งธ ์ธ์ž๋กœ role. ์ฆ‰, ์—ญํ• ์„ ๋„˜๊ธฐ๊ณ  ๋‘ ๋ฒˆ์งธ ์ธ์ž์˜ ์˜ต์…˜์—์„œname ์œผ๋กœ ๋ฒ„ํŠผ ๋‚ด๋ถ€์— ์žˆ๋Š” ์‹ค์ œ ๋…ธ์ถœ๋˜๋Š” ํ…์ŠคํŠธ๋ฅผ ๋„˜๊ธฐ๊ฒŒ ๋˜๋Š”๋ฐ์š”, ์—ฌ๊ธฐ์„œ name์ด ๋ฐ”๋กœ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•œ name์ธ accessible name์ด ๋ฉ๋‹ˆ๋‹ค.
  • byRole์ด ์š”์†Œ ์ฟผ๋ฆฌ๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ์ ‘๊ทผ์„ฑ ํŠธ๋ฆฌ๋Š”, ๋‹น์—ฐํ•˜๊ฒŒ๋„ ์‚ฌ์šฉ์ž๊ฐ€ ์‹ค์ œ๋กœ ์ ‘๊ทผํ•  ์ˆ˜ ์—†๋Š” ์š”์†Œ๋“ค์— ๋Œ€ํ•ด์„œ ์ œ์™ธํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

์ ‘๊ทผ์„ฑ ํŠธ๋ฆฌ์—์„œ ์ œ์™ธ๋˜๋Š” ์กฐ๊ฑด๋“ค์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  1. ์ƒ์œ„ Element ํ˜น์€ Element ์ž์ฒด์— ๋‹ค์Œ๊ณผ ๊ฐ™์€ css๊ฐ€ ์žˆ์„ ๋•Œ
    display:none, visibility:hidden
  2. Element์— role="presentation" or role="none" ์„ ๋ช…์‹œ์ ์œผ๋กœ ์„ ์–ธํ•˜์—ฌ Element์˜ ์•”์‹œ์ ์ธ ์‹œ๋ฉ˜ํ‹ฑ์„ ์ œ๊ฑฐํ•  ๋•Œ
@Jonghakseo
Jonghakseo / ์ดˆ์•ˆ.md
Created February 2, 2022 04:37
Note-for.me

Markdown Editor์˜ ํ•„์š”์„ฑ

๊ธฐ์กด์— Markdown ํŽธ์ง‘์„ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋˜ md Editor Typora๊ฐ€ 12์›”๋ถ€ํ„ฐ ์ •์‹ ์ถœ์‹œ๊ฐ€ ๋˜๋ฉด์„œ ์œ ๋ฃŒํ™”๊ฐ€ ๋˜์—ˆ๋‹ค. ์ •๋ง ์ข‹์€ ์—๋””ํ„ฐ์ด์ง€๋งŒ, ์‚ฌ์šฉ๋นˆ๋„๋„ ์ ๊ณ  ์—๋””ํ„ฐ์˜ ๊ธฐ๋Šฅ ๋Œ€๋ถ€๋ถ„์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ๋‚˜๋Š” ๊ตณ์ด ๊ฒฐ์ œ๊นŒ์ง€ ํ•ด์•ผํ•˜๋‚˜... ํ•˜๋Š” ์ƒ๊ฐ์ด ๋“ค์—ˆ๋‹ค.

๊ฒธ์‚ฌ๊ฒธ์‚ฌ ์ด๋ฒˆ ๊ธฐํšŒ์— ์˜จ๋ผ์ธ์— ์˜คํ”ˆ์†Œ์Šค๋กœ ํ’€๋ฆฐ MD editor ๋“ค์„ ํ™œ์šฉํ•ด์„œ ๋‚ด๊ฐ€ ์“ฐ๊ธฐ ํŽธํ•œ ์—๋””ํ„ฐ๋ฅผ ํ•˜๋‚˜ ๋งŒ๋“ค์–ด์•ผ๊ฒ ๋‹ค ์ƒ๊ฐํ–ˆ๋‹ค.

Note-for.me

๋„๋ฉ”์ธ ๊ณ ๋ฏผ ๋ฐ ๊ฒฐ์ •์— ์ œ์ผ ์˜ค๋žœ ์‹œ๊ฐ„์ด ๊ฑธ๋ ธ๋‹ค. Md, note ํ‚ค์›Œ๋“œ๋กœ ๋งŽ์€ ๋„๋ฉ”์ธ์„ ์ฐพ์•„๋ดค๊ณ , ๊ฒฐ๊ตญ ๋งˆ์Œ์— ๋“œ๋Š” Note-for.me ๋ผ๋Š” ๋„๋ฉ”์ธ์„ ์ฐพ์•„์„œ ๊ตฌ๋งคํ–ˆ๋‹ค. ๊ฐ€๊ฒฉ์€ 1๋…„์— โ‚ฉ7,700 ์œผ๋กœ ์ ๋‹นํ–ˆ๋‹ค.