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
// String 채우기(padding) | |
// 사용법: getPaddedStr(원본문자열, 패딩이 포함된 총 길이, 채울 문자열, 채울 방향) | |
// ex) getPaddedStr("1135j", 10, "#", "left") = "#####1135j" | |
function getPaddedStr(strOrg, width, to, direction) { | |
if(!strOrg) return ""; | |
var strOrg = new String(strOrg), len = strOrg.length; | |
if(len >= width) return strOrg; | |
var strPad = new Array(width - len + 1).join(to); | |
return (direction == "left" |
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
// 필요 정보를 담은 객체를 입력하면 페이징 정보를 추가해서 반환해 주는 함수 | |
// 필요 정보: 객체. currPage(현재페이지), totalArticles(전체 글 수), rowsPerPage(1페이지 당 글 수), pagesPerView(1뷰 당 페이지 수) | |
// IE 11 CAPABLE | |
function getPagingProps(p) { | |
// Chksum | |
if(typeof p === "undefined") throw new Error("'p' object required"); | |
if(typeof p != "object") throw new Error("'p' must be an object"); | |
["currPage", "totalArticles", "rowsPerPage", "pagesPerView"].forEach(function(i) { | |
if(!p.hasOwnProperty(i) || isNaN(parseFloat(p[i]))) throw new Error("'" + i + "' has an error"); |
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 getDateByString(dateStr) { | |
// String 미입력 시 return | |
if(dateStr == undefined || !dateStr || typeof dateStr != "string" || dateStr.length < 10) return; | |
console.log(dateStr); | |
// YMD | |
var year = parseInt(dateStr.substring(0, 4)); |
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 java.io.File; | |
import java.util.Scanner; | |
public class Debug { | |
// 디버그용 로그인여부 지시 파일 내용이 true인지 아닌지, | |
// 즉 강제 로그인을 지시했는지 아닌지를 알아내어 회신 | |
// Open a file which indicates about the debug mode, | |
// get the debug mode is true or not, and return it | |
public static boolean getDebug() { |
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 downloadExecute(downloadURL) { | |
fetch(downloadURL) | |
.then(function(response) { | |
return response.blob(); | |
}).then(function(blob) { | |
var fileBlob = new Blob([blob], {type: blob.type}); | |
var aLink = document.createElement("a"); | |
aLink.href = window.URL.createObjectURL(fileBlob); | |
aLink.download = decodeEntity(pageData.fileName); |
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
<!-- | |
I made this to use spinner with the simplest way and with reduced code. | |
Usage → Simple | |
① CSS code → Edit the size/color in :root{} and paste all to ur page. | |
② HTML → Just type <div class="spinner"></div> at the location u want. | |
③ Want to turn on the spinner? just add ".loading" class to the spinner element. | |
Want to turn off? remove ".loading" class. | |
Done. That's all. |
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
// Get the names & values of one specific form by the name in the page | |
// limitations: can be used only for simple form (no relation with other tags) | |
// 특정 이름의 form 내역 출력 | |
function showFormStr(name) { | |
var str = ""; | |
document.forms[name].childNodes.forEach((el) => { | |
if(el.name !== undefined && el.name.length > 0) str += el.name + " = " + el.value + "\n"; | |
}); | |
console.log(str); | |
} |
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
코드 단축 및 기능 확장을 위해 만들어본 라이브러리입니다. | |
1. $.pr / $.pn / $.pf : 코드단축용 메소드 | |
// System.out.print → $.pr 코드단축 | |
// System.out.println → $.pn 코드단축 | |
// System.out.printf → $.pf 코드단축 | |
public static void pr (Object o) { System.out.print(o); } |
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
// Returns the Table String from a String[][] data | |
public static String getTableStr (String[][] data) { | |
// Calculate the maximum lengths of the each columns | |
int[] len = new int[data[0].length]; | |
Arrays.fill(len, 0); | |
for(String[] str: data) { | |
for(int i = 0; i < str.length; i++ ) { | |
String val = str[i]; | |
int stringLen = val == null ? 0 : val.length(); | |
if(stringLen > len[i]) len[i] = stringLen; |
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
public class Main { | |
// Returns the string which changed all characters after 'n'th to * | |
public static String strToStar(String s, int n) { | |
return s.substring(0, n) | |
+ new String(new char[s.length() - n]) | |
.replace("\0", "*"); | |
} | |
// Test |