Skip to content

Instantly share code, notes, and snippets.

View yungblud's full-sized avatar
๐Ÿ„โ€โ™‚๏ธ

Dong-Ho Choi yungblud

๐Ÿ„โ€โ™‚๏ธ
View GitHub Profile
@yungblud
yungblud / RxSwift.md
Last active March 25, 2018 01:39
RxSwift

Observable

func someFunc() -> Observable { }

var a = 10 
var b = 20
var c = a + b
@yungblud
yungblud / login-with-github.md
Created June 6, 2019 14:05 — forked from ninanung/login-with-github.md
Github๋กœ ๋กœ๊ทธ์ธํ•˜๊ธฐ!

Github๋กœ ๋กœ๊ทธ์ธํ•˜๊ธฐ feat.Vue and Node.js

1. Github๋กœ ๋กœ๊ทธ์ธํ•˜๊ธฐ?

์š”์ฆ˜๋“ค์–ด "~๋กœ ๋กœ๊ทธ์ธํ•˜๊ธฐ" ๊ฐ€ ๋งŽ์•„์ง€๊ณ  ์žˆ๋‹ค. ํŽ˜์ด์Šค๋ถ์ด๋‚˜ ๊ตฌ๊ธ€์ด ๋Œ€ํ‘œ์ ์ด๊ณ , ํ•œ๊ตญ์—์„œ๋Š” ๋„ค์ด๋ฒ„๋„ ๋งŽ์ด ์‚ฌ์šฉํ•˜๋ฉฐ ๊ฐœ๋ฐœ์ž ๊ด€๋ จ ์›น์—์„œ๋Š” ๊นƒํ—ˆ๋ธŒ๋„ ๊ปด์žˆ๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๋‹ค. ์ด๋Ÿฐ ์‹์˜ ๋‹ค๋ฅธ ์„œ๋น„์Šค๋ฅผ ํ†ตํ•ด ์ธ์ฆํ•˜๋Š” ๋ฐฉ์‹์„, OAuth ์ธ์ฆ ๋ฐฉ์‹์ด๋ผ๊ณ  ํ•˜๋Š” ๋ชจ์–‘์ด๋‹ค. ๋‚ด๊ฐ€ ํšŒ์‚ฌ ์—…๋ฌด๋ฅผ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๋ช‡๋ช‡ ์†Œํ”„ํŠธ์›จ์–ด๋„ ์ด๋Ÿฌํ•œ ์ธ์ฆ์„ ์ง€์›ํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ๋‹ค. ์ด ๊ธ€์—์„œ๋Š” ๊ทธ๋Ÿฌํ•œ ์ธ์ฆ์„ ๊ตฌํ˜„ํ•˜์ง€๋Š”๊ฒŒ ์•„๋‹ˆ๋ผ ๊ทธ๋Ÿฌํ•œ ์ธ์ฆ์„ ์‚ฌ์šฉํ•ด ๋ณด์ž๋Š” ๊ฒƒ์— ๋ชฉ์ ์„ ๋‘”๋‹ค. ์–ด๋–ค ๋ฐฉ์‹์œผ๋กœ ์ธ์ฆํ•˜๋Š”์ง€๋ฅผ ์ง์ ‘ ์‚ฌ์šฉํ•ด๋ณด๊ณ  OAuth๋ฐฉ์‹ ์ธ์ฆ์˜ ์ ˆ์ฐจ๋ฅผ ์•Œ์•„๋ณด๋Š” ๊ธฐํšŒ๋„ ๋ ๊ฒƒ์ด๋‹ค.

2. ๋ชฉํ‘œ

๋ชฉํ‘œ
์œ„์™€ ๊ฐ™์ด ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด Github์—์„œ ์ธ์ฆ์„ ์‹คํ–‰ํ•˜๊ณ  ๊ด€๋ จ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ›์•„์˜ค๋Š” ๋™์ž‘์„ ๊ตฌํ˜„ํ•ด ๋ณผ ๊ฒƒ์ด๋‹ค.

createGlobalStyle

import { createGlobalStyle } from 'styled-components'

const GlobalStyle = createGlobalStyle`
  body {
    color: ${props => (props.whiteColor ? 'white' : 'black')};
  }
`

AWS๋ฅผ ์“ฐ๋Š” ... (๋ฌด๋ฃŒ๋กœ์“ฐ๋Š” ํ˜น์€ ๋Œ๋ ค๋ง‰๊ธฐ ํ•˜๋Š”...) ์ €๊ฐ™์€ ์‚ฌ์šฉ์ž์—๊ฒŒ ๊ผญํ•„์š”ํ•œ DB๋คํ”„ํ•˜๊ณ  ๋ฎ์–ด์“ฐ๊ธฐ !

์ด ๋ธ”๋กœ๊ทธ ๋˜ํ•œ 10๊ฐœ์›” ๋‚จ์ง“ ๋‚จ์€๊ฒƒ ๊ฐ™์€๋ฐ ํ•œ 9๊ฐœ์›” ์ •๋„ ๋‚จ์•˜์„๋•Œ์— ๋คํ”„ ๊ณผ์ •์ด ํ•„์š”ํ• ๊ฑฐ ๊ฐ™์•„์„œ ์„œํ•‘ ํ›„ ๊ธ€์„ ๋‚จ๊ธด๋‹ค.

๋คํ”„ํ•˜๊ธฐ

์ผ๋‹จ ๋ชฝ๊ณ ๋””๋น„๊ฐ€ ๊น”๋ ค์žˆ๋‹ค๋ฉด, mongodump๋ผ๋Š” ๋ช…๋ น์–ด๋กœ ๋คํ”„๋ฅผ ์‹œ์ผœ์•ผํ•œ๋‹ค.

์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๊ฒŒ ๋˜๋ฉด ๋‚ด ํ˜„์žฌ ์œ„์น˜์— dump๋ผ๋Š” ํด๋”๊ฐ€ ์ƒ๊ธฐ๊ฒŒ๋œ๋‹ค.

Access With Password

$ mongo -u username 127.0.0.1/admin

Create Root User

use admin;

Setup AWS Credentials for sls create

$ serverless config credentials --provider aws --key IAM_ACCESS_KEY --secret IAM_SECRET_KEY

or

with over-write config (~/.aws/credentials)

$ yarn global add pm2
$ export PATH="$PATH:$HOME/.config/yarn/global/node_modules/.bin"
$ pm2 --version
2.10.1
@yungblud
yungblud / download-file.js
Created July 10, 2019 09:09 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);