본문 바로가기
반응형

tech documents/memo27

mongoDB collection 이름이 복수형으로 바뀔때 서론 mongoDB collection의 기본 naming convention은 소문자의 복수형이다. 그렇기 때문에 특정해주지 않으면 자동으로 db상에 복수형으로 저장이 된다. 해결법 mongoose.model('post', postSchema, 'post'); 이처럼 collection name을 3번째 인자로 넘겨주면 된다 2022. 3. 3.
github 특정 파일 모든 commit에서 삭제 하기 github에 잘못 올라간 설정 파일을 모든 커밋으로부터 제거하기 위해서는 아래와 같이 하면 된다. 파일명이 .env인 경우 git filter-branch --tree-filter 'rm -rf .env' HEAD 그리고 나서 git push origin master 깃허브에 푸쉬해주면 된다. 2022. 3. 2.
Ubuntu에서 폰트 설치하는 방법 코딩 할 때 가독성이 좋은 폰트를 사용하고 싶은 경우가 있다. 그럴 때 고정폭 폰트를 다운받아서 설치해야 하는데, .ttf파일을 우분투 기본 fonts프로그램을 설치하면 굉장히 오랜시간이 걸리고, 설치가 되었는지 확실하게 구분이 되질 않는다. 위의 사진에서 Install을 누르는 경우 windows에서 처럼 한번에 설치가 되지 않을 뿐 더러 오랜 시간이 걸린다. 설치 방법 https://www.nerdfonts.com/ 위 링크에 접속하여, Downloads를 클릭한다. Nerd Fonts - Iconic font aggregator, glyphs/icons collection, & fonts patcher Iconic font aggregator, collection, & patcher: 3,600+ .. 2022. 2. 11.
makefile https://wh00300.tistory.com/193?category=962385 Linux gcc를 이용한 컴파일 / Makefile study(2) 이번에는 makefile을 실제로 작성 해보겠습니다. 먼저 linux환경이 필요한데, linux환경 없이 window만 사용하신 분은 본 블로그의 wsl 설치 포스팅을 참조하시기 바랍니다. pwd에는 다음과 같이 구 wh00300.tistory.com CC:=g++ CFLAGS=-Wall -g TARGET=bin/main SRC_DIRS=src SRCS=$(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp)) OBJS=$(SRCS:.cpp=.o) run: all ./$(TARGET) all: clean $(OBJS).. 2022. 2. 9.
Alacritty 터미널 설치하기 ubuntu 21.10 버전을 설치하고, gnome에서 기본으로 제공되는 terminal이 별로 마음에 안들어서 다른 terminal을 찾아보다가 alacritty를 발견했다. opengl 을 사용한 그래픽 가속으로 가볍고 속도가 빠른게 특징이라고 한다. sudo apt install alacritty 처음에는 위와 같이 apt 패키지 관리자로 설치했지만, 무슨 이유에서 인지 터미널에서 오류를 뿜어내며 실행이 되지 않았다. 그래서 어쩔 수 없이 직접 빌드하는 길을 택했다. Ubuntu 21.10 버전을 기준으로 한다. 1. cargo 설치하기 https://doc.rust-lang.org/cargo/getting-started/installation.html rust를 설치하면 cargo도 자동으로 설치.. 2022. 2. 7.
코드 조각모음 height-balanced-BT Binary Tree가 height-balanced 인지 확인하는 코드이다. struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode() : val(0), left(nullptr), right(nullptr) {} TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} }; class Solution { public: int search(TreeNode* t, bool& check){ if(!t) ret.. 2022. 1. 20.
redux-persist not working github.com/rt2zz/redux-persist/issues/1114 redux-persist not persisting · Issue #1114 · rt2zz/redux-persist I first used it in my on-going app and it did not work. Then created a new react app and configured redux and redux-persist but still, it's not working. It stores the store in localstorage, but... github.com 2020. 9. 16.
[React] async 함수의 리턴 값 async 함수의 리턴은 resolved된 Promise 객체이다. 그리고 리턴 값은 Promise 객체에 담긴다. async 함수에서 reject된 Promise 객체를 리턴하려면 throw를 사용하면 된다. throw 뒤의 문자열이 rejected된 Promise 객체에 담기게 된다. 하지만 문제가 조금 발생한다. rejected 된 Promise가 처리 되지 않았다. 그래서 아래와 같이 try~catch 문을 사용한다. 2020. 9. 12.
[React] redux-saga yield의 원리 saga는 제너레이터 함수의 yield에서 call effect가 발생할때 promise가 resolve될 때까지 기다리다가, 완료되면 제너레이터의 next()를 호출하여 다음으로 이동한다. 2020. 9. 12.
[우아한 테크러닝 3기] 클로저 function foo(a) { return function(b) { return function(c) { return a + b + c; } } } const foo = a => b => c => a + b + c; - `커링` 이러고 일컫음. 클로저를 사용한 예시임. 2020. 9. 3.
반응형