Skip to content

Instantly share code, notes, and snippets.

@healim
healim / recipe_express-server-running.md
Last active July 11, 2018 01:30
recipe_express-서버-실행
  1. express 앱 객체 만들기
const app = express()
  1. port 정의
const port = process.env.PORT || 3000
  1. port 설정
@healim
healim / ingredient_immediate-functions.md
Last active July 11, 2018 08:46
자바스크립트 ()() 문법(?)
// 세션 저장용 모듈
var session = require('express-session');
var MongoStore = require('connect-mongo')(session);

코드 작성하다가 종종 method()() 이런 표현식 나오는데 이게 뭐하는건지 잘 몰라서 찾아봄

문법은 아니고 패턴이라고 함

  • module 이랑 같이 쓰기
@healim
healim / ingredient_git-command.md
Last active July 12, 2018 09:24
git 명령어
  1. remote repository 확인 (ref)
git remote -v
// origin	https://github.com/healim/proj-gg.git (fetch)
  1. remote repository 삭제 (ref)
git remote rm [repository 이름]
@healim
healim / concat-test.md
Last active July 18, 2018 08:32
javascript concat 데이터타입에 따라 오브젝트 결정
/**
 * concat은 String, Array 둘다에 있음
 * 값 타입이 배열이면 Array.concat()이 선택되고, 문자열이면 String.concat() 호출됨
 * => 즉 데이터 타입에 따라 오브젝트가 결정된다. (자바스크립트 특징)
 */

let sentenceOne = "hello world".concat(" test")
let sentenceTwo = ["hello", " ", "world"].concat([" test"])
let sentenceThree = "hello world".concat([" test"])
@healim
healim / variables.md
Last active July 18, 2018 08:28
QQ. javascript 변수, 메모리에서 어떻게 관리하는지
var variableTest = "hi"
variableTest = "hello"
var variableTest = "Good Morning"

const constTest = "hi"
// constTest = "hello"
// const constTest = "Good Morning" 
// 구문 오류 : Identifier 'constTest' has already been declared
@healim
healim / var-let-const.md
Last active July 18, 2018 08:58 — forked from LeoHeo/var-let-const.md
javascript var, let, const 차이점

var, let, const 차이점은?

  • varfunction-scoped이고, let, constblock-scoped입니다.

  • function-scopedblock-scoped가 무슨말이냐?

var(function-scoped)

jsfiddle 참고주소

@healim
healim / null-undefined.md
Created July 23, 2018 07:57
null 활용

null 활용

let headings = null;

값 할당 안 된 변수에 null 처리

  • 소소하게 좋은 점
    • const 쓸지, let 쓸지 판단하기 좋다.
  • 눈에 띄게 좋은 점
    • undefined 나왔을 때 프로세스를 거쳤는지 안 거쳤는지 알기 쉽다
      • null 미리 할당 해줬으면 프로세스는 거쳤는데 도중에 문제가 있다는 소리고, undefined는 거친 적도 없다는 소리니까 버그 고칠 때 참고할 수 있는 정보가 됨
@healim
healim / eventlistener-in-react.md
Last active July 24, 2018 06:05
eventlistener-in-react.md

리액트 컴포넌트 안에서 이벤트 리스너 정의할 때 주의할 점

import React, { Component } from "react";

// 시간을 입력해서 카운트 다운하는 엘리먼트 만들기
class AlertCounter extends Component {
  state = {
    reminds: '00:00:00'
 }
@healim
healim / rstudio-set-kor.md
Last active July 24, 2018 02:28
R Studio 한글 설정 (MAC)

R Studio 한글 설정 (MAC)

R studio에서 한글이 깨져서 찾아봄

localeToCharset()로 확인해보니 아스키로 되어있었다. (default text encoding을 UTF-8로 설정한거랑 무관했음)

터미널에 아래 명령어를 입력하고 재실행하니 해결됨 (실행 경로 상관 없음)

defaults write org.R-project.R force.LANG en_US.UTF-8
@healim
healim / js_understore-identify.md
Last active July 24, 2018 04:46
자바스크립트 underscore(_) 식별자 활용 + javascript OOP 질문

자바스크립트 underscore(_) 식별자 활용

  • 리액트 Context API 튜토리얼에서 리액트 클래스 생성자 안에 언더스코어_ 사용해서 어떤 의미인지 찾아봄
  • 캡슐화 패턴이랑 관련 있는 것 같다
  • 생성자 안에서 쓴거 보니까 이런 의도로 쓰는