스터디 용도 등으로 로컬 환경에서 PostgreSQL을 띄우는 것은 생각보다 간단하다. 우선 로컬에서 PostgreSQL 이미지와 매핑할 적당한 디렉토리를 준비한 후, 다음과 같이 입력한다. [~] docker pull postgres:14.6 # 생각해보니까 요 줄은 생략해도 아래 명령어에서 알아서 될 것 같다. [~] docker run -p 35432:5432 --name my-first-pg-docker \ -e POSTGRES_PASSWORD=my-insecure-secret -e TZ=Asia/Seoul \ -v [여기에 내 로컬 환경의 적당한 경로를 입력]/pgdata:/var/lib/postgresql/data \ -d --restart always postgres:14.6 -p 옵션은 [..
opt + opt(누른 상태에서) 아래 또는 위 화살표 요 방법으로 여러 줄을 동시에 수정할 수 있는데, opt를 두 번 눌러줘야 하는 점이 헷갈리기 쉽다. JetBrains 측에서는 멀티 커서(multiple cursors)라는 용어를 쓴다고 함! 또한, 여러 줄을 원하는 만큼 선택하고 꾹 눌렀던 opt를 놓은 후에는 내가 선택한 멀티 커서를 화살표 키로 움직일 수 있다. 글로만 봐서는 뭔 소린지 모를 수 있는데, 직접 해보면 진짜 움직인다...
연속적인 async 함수의 호출을 함수형으로 처리하기 위해 async한 pipe 함수를 다음과 같이 구현할 수 있다. (async function main() { const results = await pipeAsync( getTargetAsync, pickAlias, getInfoAsync, getFriendsAsync )("injuk"); console.log(results); /* 실행 결과 [ { id: '222', name: 'two', bf: 'ingnoh' }, { id: '333', name: 'three', bf: 'ingnoh' }, { id: '444', name: 'four', bf: 'ingnoh' } ] */ })(); function pipeAsync(...asyncFun) {..
JS를 사용하다보면 함수 내부에서 this 참조가 원하지 않는 객체를 참조하거나 아예 유실되어버리는는 경우가 종종 발생한다. 이러한 경우에 사용할 수 있도록 JS에서는 Function.prototype의 call, apply, bind를 제공하고있으며, 세 메소드는 모두 함수에 this 참조를 연결한다는 공통점을 갖지만 사용법 측면에서 다음과 같은 소소한 차이가 있다. Function.prototype.call: 함수 내부에서 참조할 this와 매개 변수 목록을 하나씩 나열하여 전달하는 식으로 함수를 호출한다. Function.prototype.apply: 함수 내부에서 참조할 this와 매개 변수 목록을 배열로 전달하는 식으로 함수를 호출한다. Function.prototype.bind: 함수 내부에서..
환경 | MacBook Pro(2019), Ventura 13.0 Rust를 처음 배울 때, rustc 를 활용한 Hello World 애플리케이션의 컴파일이 다음과 같이 실패할 수 있다. error: linking with `cc` failed: exit status: 1 | = note: "cc" "-arch" "x86_64" "-m64" ... 중략 ... = note: xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun error: aborting due to previous err..
다음과 같이 getter에 async 키워드를 작성할 경우에는 Syntax Error가 발생한다. SyntaxError: Unexpected identifier class MyClass { #props = { hello: 'world' }; async get result() { // SyntaxError: Unexpected identifier return this.#props; } } (async function main() { const myInstance = new MyClass(); const result = await myInstance.result; console.log(result); })(); 이 경우, 그냥 Promise를 반환하면 간단하게 async getter를 구현할 수 있다. cl..
일반적으로 falsy한 값의 체크는 다음과 같이 확인한다. function isFalsy(value) { return !value ? true : false; } console.log(isFalsy(undefined)); // true console.log(isFalsy(null)); // true console.log(isFalsy(0)); // true console.log(isFalsy('')); // true console.log(isFalsy([])); // false console.log(isFalsy({})); // false /* 요런 특징을 이용해서 if(value) 또는 if(!value)로 활용하곤 한다. */ 그러나 0과 빈 문자열은 검증하지 않고, 오로지 null 또는 undefi..
- Total
- Today
- Yesterday
- Java
- hashicorp
- Gradle
- pgloader
- Spring Cloud Config
- AWS IoT
- terraform
- postgresql
- javascript
- kotlin
- Vault
- 코딩테스트
- JPA
- AWS
- Node.js
- spring boot
- eureka
- Docker
- Puppeteer
- dev
- Linux
- jQuery
- etc
- IntelliJ
- react
- Git
- Database
- mysql
- JEST
- shell
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |