This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imageToByteArray(e) { | |
const that = this; | |
const file = e.target.files[0]; | |
const reader = new FileReader(); | |
reader.onloadend = function() { | |
// with react | |
that.setState({img: reader.result}); | |
}; | |
reader.readAsDataURL(file); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const add = (a) => (b) => (dispatch, getState) => a + b; | |
export const add10 = add(10); | |
export const add20 = add(20); | |
// result : 11 | |
console.log(add10(1)); | |
// result : 21 | |
console.log(add20(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 길이가 n인 배열에 1부터 n까지 숫자가 중복 없이 한 번씩 들어 있는지를 확인하려고 합니다. | |
# 1부터 n까지 숫자가 중복 없이 한 번씩 들어 있는 경우 true를, 아닌 경우 false를 반환하도록 함수 solution을 완성해주세요. | |
# 제한사항 | |
# 배열의 길이는 10만 이하입니다. | |
# 배열의 원소는 10만 이하의 자연수입니다. | |
# arr result | |
# [4, 1, 3, 2] true | |
# [4, 1, 3] false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this.state.count : 1 | |
incrementCount(){ | |
this.setState({count : this.state.count + 1}) | |
this.setState({count : this.state.count + 1}) | |
} | |
// this.state.count : 2 | |
incrementCount(){ | |
this.setState((prevState, props) => { | |
count: prevState.count + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
incrementCount(prevState, props) { | |
return { | |
count: prevState.count + 1, | |
}; | |
} | |
handleCount() { | |
this.setState(incrementCount); | |
this.setState(incrementCount); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { incrementCount } from 'stateChanges'; | |
handleCount() { | |
this.setState(incrementCount); | |
this.setState(incrementCount); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function turn(m, n, board, answer) { | |
var removeItem = []; | |
for (var i = 1; i < m; i++) { | |
for (var j = 1; j < n; j++) { | |
var item = board[i][j]; | |
if (item === '0') continue; | |
var topLeft = board[i - 1][j - 1]; | |
var top = board[i - 1][j]; | |
var left = board[i][j - 1]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 입력으로 주어진 판 정보를 가지고 몇 개의 블록이 지워질지 출력하라. | |
// m n board answer | |
// 4 5 [CCBDE, AAADE, AAABF, CCBBF] 14 | |
// 6 6 [TTTANT, RRFACC, RRRFCC, TRRRAA, TTMMMF, TMMTTJ] 15 | |
function turn(m, n, board, answer) { | |
var removeItem = []; | |
for (var i = 1; i < m; i++) { | |
for (var j = 1; j < n; j++) { | |
var item = board[i][j]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch({ | |
headless: false, | |
slowMo: 250 // slow down by 250ms | |
}); | |
const page = await browser.newPage(); | |
await page.setViewport({width: 1920, height: 1024}); | |
await page.goto('https://naver.com'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'}); | |
await page.pdf({path: './pdf/hn.pdf', format: 'A4'}); | |
await browser.close(); | |
})(); |
OlderNewer