Skip to content

Commit 60a53cc

Browse files
committed
Quartz sync: Jul 2, 2025, 9:43 PM
1 parent 68acf50 commit 60a53cc

File tree

14 files changed

+140
-40
lines changed

14 files changed

+140
-40
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
description:
3+
aliases:
4+
created: 2025-07-02
5+
modified: 2025-07-02
6+
---
7+
8+
- 마지막 비트 크기로 현재 인덱스의 '저장 개수' 계산
9+
- `i & -i`
10+
- ```cpp
11+
int tree[sum_size];
12+
13+
int sum(int i){
14+
int res = 0;
15+
while (i > 0){
16+
res += tree[i];
17+
i -= (i & -i);
18+
}
19+
return res;
20+
}
21+
22+
void update(int i, int dif){
23+
// update값이 dif
24+
// 기존 값과의 dif를 점진적 비트 크기로 이동하면서 업데이트
25+
while (i <= sum_size){
26+
tree[i] += dif;
27+
i += (i & -i);
28+
}
29+
}
30+
31+
int getSection(int start, int end){
32+
return sum(end) - sum(start - 1);
33+
}
34+
- [[Prefix Sum Array|psum]]과의 차이는?
35+
- psum은 일차원 배열
36+
- fenwick tree는 배열이지만 가상적 트리 구조
37+
- 빈번한 업데이트에 따른 구간 합
38+
- 펜윅트리, 세그먼트 트리가 유리
39+
- 업데이트 없고, 구간합만 필요
40+
- psum만 사용해도 충분
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
description:
3+
aliases:
4+
created: 2025-07-02
5+
modified: 2025-07-02
6+
---
7+
8+
# winning formula
9+
- 가지 수를 이진수로 XOR 연산
10+
- 결과가 0이면 지는 상태
11+
- 0이 아니면 이기는 상태
12+
-
13+
- 상자 A에 3개, B에 5개 있으면:
14+
- $3 \oplus 5 = 6$ -> 이기는 상태
15+
- 상자 A에 4개, B에 4개:
16+
- $4 \oplus 4 = 0$ -> 지는 상태

content/Computer Science/5 Software Development/Programming Language/JavaScript/Module.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,36 @@
22
description:
33
aliases:
44
created: 2025-06-09
5-
modified: 2025-06-09
5+
modified: 2025-07-01
66
---
77

8-
- 모든 버전의 노드에서 지원하는 일반적인 모듈 패턴
9-
- ```js
10-
const print() => log();
11-
const log() => console.log();
12-
13-
module.exports = {pritn, log};
14-
15-
//---
16-
17-
const {log, print} = require('./source-location')
18-
- 동적 임포트
8+
- CJS
9+
- 모듈 시스템이 필요해짐에 따라 표준이 없었기에 서버 사이드에서 최초 적용
10+
- 모든 버전의 Node.Js에서 지원하는 일반적인 모듈 패턴
11+
- `require`
12+
- `module.exports`
13+
- ```js
14+
const print() => log();
15+
const log() => console.log();
16+
17+
module.exports = {pritn, log};
18+
19+
//---
20+
21+
const {log, print} = require('./source-location')
1922
- 트리 쉐이킹에 어려움
20-
- `import`
23+
- npm 패키지 시스템 발전 영향
24+
- ESM
25+
- 정적 구조
26+
- 최적화 가능
27+
- 키워드
28+
- `import`
29+
- `export`
30+
- named export
31+
- `export default`
32+
- default export
33+
- 장점
34+
- 트리 쉐이킹
35+
- 동적 임포트
36+
- 표준화
37+
- 모듈 스코핑
180 KB
Loading
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
- ref를 단순하게 자식에게 전달하면 `{ current : null}`로 전달됨
1+
- [[useRef|ref]] 단순하게 자식에게 전달하면 `{ current : null}`로 전달됨
22
- 접근해야하는 실제 dom 요소를 받으려면 `forwardRef`로 자식 컴포넌트 래핑
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
description:
3+
aliases:
4+
created: 2025-07-01
5+
modified: 2025-07-01
6+
---
7+
8+
- ![[image-react lift cycle method.png|800]]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- 직접 DOM 접근
2+
- 리액트 생명주기 외의 변수를 관리하고 싶을 때
3+
- 렌더링에 영향을 미치지 않는 변수가 필요할 때
4+
- 스크롤 위치 등

content/Computer Science/7 Applications Development/Frontend/Terms/ErrorBoundary.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
2-
created: 2025/4/11 15:07:05
3-
modified: 2025/4/13 16:03:26
2+
description:
3+
created: 2025-05-18
4+
modified: 2025-07-01
45
aliases:
56
- 오류경계
67
- 오류 경계
78
---
9+
810
- ```js
911
import React, { Component } from "react";
1012

@@ -32,4 +34,9 @@ aliases:
3234
- 오류 발생하면 `state.error` 설정
3335
- 오류가 있으면 `fallback 컴포넌트` 렌더링
3436
- 이 컴포넌트의 프로퍼티로 오류 전달
35-
- 다른 컴포넌트에 합성해서, 트리에서 발생하는 오류를 포획하고 `fallback 컴포넌트` 렌더링
37+
- 다른 컴포넌트에 합성해서, 트리에서 발생하는 오류를 포획하고 `fallback 컴포넌트` 렌더링
38+
- with [Sentry.io](https://sentry.io/)
39+
- ```js
40+
if(process.env.NODE_ENV === 'production' ) {
41+
Sentry.captureException(error, { extra: info });
42+
}
Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
---
2-
description:
2+
description:
33
aliases:
4+
- 이벤트 버블링
5+
- 이벤트 캡처링
46
created: 2025-04-14
5-
modified: 2025-06-23
7+
modified: 2025-07-01
68
---
79

810
- 이벤트가 부모 요소로 전달되는 현상
911
- 이벤트 전파 3 단계 (이벤트 전파는 자동으로 실행됨)
1012
- Capturing
13+
- 이벤트가 발생한 하위 요소로 내려가는 과정
1114
- `element.addEventListener('click', handler, true);`
1215
- Target
1316
- 해당 이벤트 리스너 실행, 캡처링 중단
1417
- Bubbling
18+
- 상위 요소로 이벤트가 전파되는 과정
1519
- `element.addEventListener('click', handler, false 또는 생략);`
20+
- 브라우저의 기본 이벤트 처리방법
21+
- 최상위 요소까지 전파됨(body, html까지)
1622
- 장점
1723
- 상위 컴포넌트에서 하위 이벤트 감지 - 이벤트 위임
1824
- 부모 하나에만 리스너 달고, 자식의 이벤트 처리 가능
1925
- 자식마다 이벤트 안달아도 된다
20-
- 버블링 막기
21-
- 해당 이벤트가 부모로 전파되는 것을 막음
26+
- 이벤트 전파 막기
2227
- `e.stopPropagation()`
23-
- portal에서 이벤트 버블링른 DOM트리가 아닌 리액트 트리를 따라간다
28+
- 해당 이벤트가 전파되는 것을 막음
29+
- 버블링, 캡처링 둘다 가능
30+
- 기본 동작 방지
31+
- `e.preventDefault()`
32+
- 해당 이벤트에 브라우저가 수행하는 기본 동작을 막음
33+
- `form -> submit`은 브라우저가 refresh됨
34+
- portal에서 이벤트 버블링은 DOM트리가 아닌 리액트 트리를 따라간다

content/Computer Science/7 Applications Development/Frontend/Terms/Event delegation.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
2-
description:
2+
description:
33
aliases:
4+
- 이벤트 위임
45
created: 2025-06-23
56
modified: 2025-06-23
67
---
7-
8+
- 이벤트 리스너를 각각의 자식들에게 반복적으로 설정하는 것이 아닌, 한 곳(부모)에서 처리
9+
- [[Event bubbling, capturing|이벤트 버블링]]을 활용하여
810
- ```js
911
const liEls = document.querySelectorAll('li')
1012
liEls.forEach(liEl => {

0 commit comments

Comments
 (0)