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
// str를 입력받아, 이것이 kebobcase 혹은 camelcase이면, 대문자 단어들을 밑줄로 연결하는 DB용 컬럼명 형식으로 바꿔주고, | |
// 반대로 DB용 컬럼명 형식을 받는다면 camelcase로 변환해 주는 함수이다. 파견지에서 인터넷 끊어놓고 작업하라고 할 때 자주 쓰여서 메모. | |
function convertCase(str) { | |
return str.includes('-') || str.includes('_') | |
? str.toLowerCase().replace(/[-_](.)/g, (m, c) => c.toUpperCase()) | |
: str.replace(/([a-z])([A-Z])/g, '$1_$2').toUpperCase() | |
} | |
const result = convertCase('superStatCd') |
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
package y24.m05.d13.c01_BigDecimal_exp; | |
import lombok.extern.slf4j.Slf4j; | |
import org.junit.jupiter.api.Test; | |
import java.math.BigDecimal; | |
import java.math.MathContext; | |
import java.math.RoundingMode; | |
@Slf4j |
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 generateRandomPassword(length) { | |
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=[]{}|;:,.<>? "; | |
let password = ""; | |
for (let i = 0; i < length; i++) { | |
const randomIndex = Math.floor(Math.random() * charset.length); | |
password += charset[randomIndex]; | |
} | |
return password; | |
} |
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 a1; | |
var a2 = []; | |
var a3 = {}; | |
var a4 = {x:undefined}; | |
var a5 = {x:'1'}; | |
console.log("a1:", a1?.x || 'error'); | |
console.log("a2:", a2?.x || 'error'); | |
console.log("a3:", a3?.x || 'error'); | |
console.log("a4:", a4?.x || '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 toCamelCase(str){ | |
var regExp=/[-_]\w/ig; | |
return str.toLowerCase().replace(regExp,function(match){ | |
return match.charAt(1).toUpperCase(); | |
}); | |
} | |
function toCamelCaseList(arr) { | |
let result = []; | |
arr = arr.split("\n"); | |
for(var a of arr) { |
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
<Style type="text/css"> | |
pre { display:none; background:red; color:white; font-weight:bold; padding:5px; width:850px; } | |
</Style> | |
<pre id="debugPre" style="display:none;"> | |
Your debugging HTML HERE | |
</pre> | |
<script type="text/javascript"> |
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 printFormData(formId) { | |
const formEl = document.getElementById(formId); | |
const formData = new FormData(formEl); | |
const params = {}; | |
for(const [key, val] of formData.entries()) { | |
params[key] = val; | |
} |
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
// 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 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 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; |
NewerOlder