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
var debounceFunction = (function() { | |
'use strict'; | |
var timeWindow = 500; // 여기에 시간(ms)을 지정한다 | |
var timeout; | |
// ES6 이하일 경우 ...args에 호출할 parameter 만큼 준다 function(arg1, arg2...) | |
var debounceFunction = function(...args) { | |
// 여기에 로직을 구현한다 | |
}; |
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
var obj = { | |
hasOwnProperty : function(){ | |
return false; | |
}, | |
data1 : 1 | |
}; | |
for (prop in obj) { | |
// obj.hasOwnproperty(prop) 의 결과는 항상 false | |
if (obj.hasOwnproperty(prop)){ |
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
for (prop in obj) { | |
// 첫번째 방법 | |
if ({}.hasOwnProperty.call(obj, prop)) { | |
} | |
// 두번째 방법 | |
if (Object.prototype.hasOwnProperty.call(obj, prop)) { | |
} |
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
var jsonReplace = function(j){ | |
if(j){ | |
j = j.replace(/\"\[/g,"\[").replace(/\]\"/g,"\]").replace(/\"\{/g,"\{").replace(/\}\"/g,"\}"); | |
} | |
return 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
SELECT SQL_CALC_FOUND_ROWS @RNUM:=@RNUM+1 AS ROWNUM, R.* FROM ( | |
SELECT @RNUM:=0, Q.* FROM ( | |
SELECT * FROM TABLE1 | |
WHERE ID = '1' | |
ORDER BY REG DESC | |
LIMIT 18446744073709551615 | |
) Q | |
) R |
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
SELECT SQL_CALC_FOUND_ROWS @RNUM:=@RNUM+1 AS ROWNUM, R.* FROM ( | |
SELECT @RNUM:=0, Q.* FROM ( | |
SELECT * FROM TABLE1 | |
WHERE ID = '1' | |
ORDER BY REG DESC | |
) Q | |
) R | |
LIMIT 0,10 |
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
// 리액트에 넣을 모듈을 선언한다. | |
class LoginForm extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {id: '', pw : ''}; | |
} | |
// input의 데이터가 변할 때 state의 값이 변경할 수 있게한다 | |
handleChange(key, event){ | |
this.state[key] = event.target.value; |
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
<input type="text" name="date" class="date"/> | |
<script> | |
$(function(){ | |
// pickadate 옵션 전역설정 | |
$.extend($.fn.pickadate.defaults, { | |
monthsFull:['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], | |
monthsShort: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'], | |
weekdaysFull: ['일', '월', '화', '수', '목', '금', '토'], | |
weekdaysShort:['일', '월', '화', '수', '목', '금', '토'], |
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
$.fn.clearForm = function() { | |
return this.each(function() { | |
var type = this.type, tag = this.tagName.toLowerCase(); | |
if (tag === 'form'){ | |
return $(':input',this).clearForm(); | |
} | |
if (type === 'text' || type === 'password' || type === 'hidden' || tag === 'textarea'){ | |
this.value = ''; | |
}else if (type === 'checkbox' || type === 'radio'){ | |
this.checked = 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
$('#id').keypress(function(e){ | |
if(e.which === 13){ | |
// do something | |
} | |
}); |