๐ฅ
This file contains hidden or 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
| // Give dynamic rainbow colored borders to ALL the elements being found in query. Quite useful for testing CSS | |
| function rainbow(query, styles) { | |
| var colors = ['Red', 'Lime', 'Blue', 'Yellow', 'Cyan', 'Magenta', 'Silver', 'Gray', 'Maroon', 'Olive', 'Green', 'Purple', 'Teal', 'Navy'] | |
| document.querySelectorAll(query).forEach(function(el) { | |
| var rand = Math.floor(Math.random() * colors.length); | |
| var color = colors[rand]; | |
| el.style.border = '2px ridge ' + color; | |
| if(styles != undefined) { | |
| for(var [key, val] of Object.entries(styles)) { | |
| el.style[key] = val; |
This file contains hidden or 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
| package utils.logging; | |
| import ch.qos.logback.classic.Logger; | |
| import ch.qos.logback.classic.LoggerContext; | |
| import ch.qos.logback.classic.encoder.PatternLayoutEncoder; | |
| import ch.qos.logback.classic.spi.ILoggingEvent; | |
| import ch.qos.logback.core.AppenderBase; | |
| import org.slf4j.LoggerFactory; | |
| public class CustomAppender extends AppenderBase<ILoggingEvent> { |
This file contains hidden or 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
| <style> | |
| @keyframes fadeout { | |
| from { opacity:1; } | |
| to { opacity:0; } | |
| } | |
| .toast { | |
| position:fixed; left:0; bottom:0; padding:10px; | |
| font-size:50px; color:red; font-weight:900; | |
| animation: fadeout 1s ease-in forwards; |
This file contains hidden or 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
| // if you put isHTML parameter true you'll get newline char as br HTML tag, or just get "\n" | |
| function jsonBeautifier(jsonTxt, isHTML) { | |
| let result = JSON.stringify(JSON.parse(jsonTxt), null, 4); | |
| if(isHTML) result = result.replaceAll("\n", "<br />"); | |
| return result; | |
| } | |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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. |