Skip to content

Instantly share code, notes, and snippets.

💜

Eunkwang Shin gracefullight

💜
Block or report user

Report or block gracefullight

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View daum_address_api.js
/**
* [searchAddr 다음주소검색 API]
* @return {[JsonArray]} [주소데이터]
* <script src="http://dmaps.daum.net/map_js_init/postcode.v2.js">가 선행되어야함
*/
var searchAddr = function(){
new daum.Postcode({
oncomplete: function(data){
var fullAddr = ''; // 최종 주소 변수
var extraAddr = ''; // 조합형 주소 변수
View cilpboard_example.html
<script src="/bower_components/clipboard/dist/clipboard.min.js"></script>
<!-- 1. URL copy -->
<a href="#" id="btnCopyUrl" data-clipboard-action="copy" >url 복사</a>
<script>
$(function({
// 복사 버튼을 만들시 data-clipboard-text 안에 복사할 문구를 넣어준다
$('#btnCopyUrl').attr('data-clipboard-text', document.location.href);
// callback 설정
var clipboard = new Clipboard('#btnCopyUrl');
View datetimepicker_with_moment_example.html
<link rel="stylesheet" type="text/css" href="/bower_components/datetimepicker/build/jquery.datetimepicker.min.css">
<!-- php.date.formatter.js 와 jquery.mousewheeel.js 를 포함하는 full.js-->
<!-- moment는 이미 선언되어있다고 가정합니다 -->
<script src="/bower_components/datetimepicker/build/jquery.datetimepicker.full.min.js"></script>
<script>
// dateTimePicker localization
$.datetimepicker.setLocale('ko');
// dateTimePicker moment.js와 연동
$.datetimepicker.setDateFormatter({
View jq_validation_error_handling_example.html
<script>
$.validator.setDefaults({
onfocusout: false,
invalidHandler: function(form, validator) { // 커스텀 포커스 핸들링
if (validator.numberOfInvalids()) {
validator.errorList[0].element.focus();
//alert(validator.errorList[0].message); // 경고창
}
},
errorClass:'text-danger', // 에러 스타일을 입힐 클래스 지정
View jq_validation_with_materialize_example.js
// p 태그를 이용하는 방법
$.validator.setDefaults({
errorClass: "invalid form-error red-text",
errorElement : 'p',
errorPlacement: function(error, element) {
var e = element.get(0);
if(e.type==='radio' || e.type==='checkbox'){
var $a = error.appendTo(element.parent());
$a.css({'margin-top':'10px'});
}else{
View number_with_commas_using_regex.js
// function
function comma(num){
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
// prototype
Number.prototype.format = function(){
return this.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
};
View js_unix_timestamp.js
// === PHP time();
var timestamp = Math.round(new Date().getTime() / 1000);
View cross_domain_session.php
<!-- 세션을 만들어줄 서버에서 P3P 헤더를 설정 -->
<?php
header('P3P: CP="CAO PSA OUR"');
?>
<!-- 세션을 가지고 오는 클라이언트 요청-->
<script>
$.ajax({
url:'cross domain session create url',
type:'post',
View js_paging_row_index.js
var totalCount;
var currentPageNum;
var shownRowNum;
for(var i=0, len=data.length; i<len; i++){
var index = (Number(totalCount)-(i+(currentPageNum-1)*shownRowNum))
}
View return_false.html
<script>
function test(){
if(true){
return false;
}
}
</script>
<!-- 페이지에 return false;가 출력됨 -->
<a href='javascript:test();'>테스트</a>
You can’t perform that action at this time.