Skip to content

Instantly share code, notes, and snippets.

@dstyle0210
dstyle0210 / date.prototype.format.js
Last active June 25, 2019 01:00
날짜구하기 Date prototype format
// 출처: https://stove99.tistory.com/46 [스토브 훌로구]
String.prototype.string = function(len){var s = '', i = 0; while (i++ < len) { s += this; } return s;};
String.prototype.zf = function(len){return "0".string(len - this.length) + this;};
Number.prototype.zf = function(len){return this.toString().zf(len);};
Date.prototype.format = function(f) {
if (!this.valueOf()) return " ";
var weekName = ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"];
var d = this;
@dstyle0210
dstyle0210 / node-selenium-webdriver-setup.txt
Last active July 29, 2019 06:22
node , selenium-webdriver 설치
// webstorm 다운로드
// https://www.jetbrains.com/webstorm/download/download-thanks.html
// git 다운로드
// https://git-scm.com/download/win
// node 다운로드
// https://nodejs.org/ko/
// chromium (.exe , path 연결)
@dstyle0210
dstyle0210 / selenium-webdriver-takeScreenshot.js
Created June 13, 2019 07:39
[selenium-webdriver] takeScreenshot
driver.takeScreenshot().then(function(data){
var base64Data = data.replace(/^data:image\/png;base64,/,"")
fs.writeFile("파일명.png", base64Data, 'base64', function(err) {
if(err) console.log(err);
});
});
@dstyle0210
dstyle0210 / selenium-webdriver-IEexplorer.js
Last active July 1, 2019 00:34
selenium-webdriver : internet explorer 실행.
// npm install [email protected]
// 셀레니움 오류로, 현재 promise 관련 메소드 (ex : then )가 동작하지 않음. => 과거 버전(3.6.0 을 사용)
var fs = require("fs");
var webdriver = require("selenium-webdriver"),By = webdriver.By,until = webdriver.until;
var capabilities = webdriver.Capabilities.ie();
capabilities.set("unexpectedAlertBehaviour", "accept");
capabilities.set("ignoreProtectedModeSettings", true);
capabilities.set("ignoreZoomSetting", true);
capabilities.set("CapabilityType.ACCEPT_SSL_CERTS", true);
capabilities.set("InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS", true);
@dstyle0210
dstyle0210 / robocopy_folderDelete.txt
Created May 10, 2019 01:24
파일명(or 폴더길이, 깊이)가 길어서 삭제가 안되는경우의 CMD
삭제할 파일이 들어있는 폴더명: E:\sts-bundle
빈 폴더를 하나 생성: E:\empty(폴더명)
윈도-> 실행 -> cmd 창을 열어서
1. 해당 디렉토리가 있는 곳으로 간다. E:
2. 아래와 같이 친다
robocopy E:\empty E:\sts-bundle /MIR
@dstyle0210
dstyle0210 / programers_level3_0.js
Created May 8, 2019 07:51
프로그래머스 : 하노이의 탑
function solution(n) {
var answer = [];
var hanoi = function(ring,from,by,to){
if(ring==1){
answer.push([from,to]);
}else{
hanoi(ring-1,from,to,by);
answer.push([from,to]);
hanoi(ring-1,by,from,to);
};
@dstyle0210
dstyle0210 / jqExtend.scrollEnd.js
Created December 26, 2018 04:28
jquery에 scrollEnd 이벤트 삽입하기.
/**
$(body).on("scrollEnd",function(){
// 스크롤이 끝날때 1번만 실행.
});
*/
var _jqExtend = {};
_jqExtend.scrollEndTimeout = null;
_jqExtend.scrollEnd = {
delegateType:"scroll",
bindType:"scroll",
@dstyle0210
dstyle0210 / preset-console.js
Created March 16, 2017 00:40
[preset] IE9에서 console.log 없는 현상
window.console = window.console || {};
console.log = console.log || function(){};
console.error = console.error || function(){};
console.warn = console.warn || function(){};
@dstyle0210
dstyle0210 / posXY.html
Created January 18, 2017 06:20
마우스 드래그 좌표저장
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Document</title>
<script src="/com/js/lib/jquery-1.11.3.min.js"></script>
</head>
<body style="padding:0;margin:0;">
@dstyle0210
dstyle0210 / es6_for_of.js
Last active January 13, 2017 01:18
[es6] for .. of 기본 사용법
var data = [{name:"won","age:"35},{name:"seo",age:"39"},{name:"kim",age:"42"}];
for(human of data){
console.log( human.name ); // won , seo , kim
};
// 참고 (for 기본구문)
for(var i=0;i<data.length;i++){
console.log( data[i].name ); // won , seo , kim
};