Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

appkr appkr

🎯
Focusing
View GitHub Profile
@appkr
appkr / AddressRefiner.java
Last active Jun 30, 2021
주소정제기 초벌
View AddressRefiner.java
package com.vroong.neogeo.support.address.refiner;
import static com.vroong.neogeo.domain.AdditionalInfo.*;
import static com.vroong.neogeo.domain.RegionType.*;
import static com.vroong.neogeo.support.address.Regex.*;
import com.vroong.neogeo.domain.AddressEntry;
import com.vroong.neogeo.domain.AddressEntry.AddressEntryBuilder;
import com.vroong.neogeo.domain.Refinable;
import com.vroong.neogeo.support.address.Regex;
@appkr
appkr / JwtExampleTest.java
Created Feb 16, 2021 — forked from gimbimloki/JwtExampleTest.java
JWT Example (Sign, Verify and etc)
View JwtExampleTest.java
package com.nhn.jwt;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.ECDSAKeyProvider;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Maps;
import com.nimbusds.jose.*;
import com.nimbusds.jose.crypto.ECDSASigner;
import com.nimbusds.jose.jwk.Curve;
@appkr
appkr / erd.md
Last active Feb 16, 2021
ERD in plantuml
View erd.md

entity entity
1 -
0 or 1 -o|
one and only 1 -||
many -{
0 or many -o{
1 or many -|{
@appkr
appkr / sql.md
Created Nov 6, 2020
SQL 합집합, 교집합, 차집합, 대칭차집합
View sql.md
CREATE TABLE tablea (str varchar(8), PRIMARY KEY (str));
CREATE TABLE tableb (str varchar(8), PRIMARY KEY (str));
INSERT INTO tablea (str) VALUES ('A'), ('B'), ('C'), ('D');
INSERT INTO tableb (str) VALUES ('C'), ('D'), ('E'), ('F');
-- 합집합
@appkr
appkr / DatabaseCleaner.java
Last active Oct 23, 2020
snippets for Integration Test (Test Isolation)
View DatabaseCleaner.java
package ...;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashSet;
@appkr
appkr / Jconsole.md
Last active Nov 24, 2020
Jconsole - JVM profiler
View Jconsole.md
$ which jconsole
# /Users/appkr/.jenv/shims/jconsole

$ jconsole

@appkr
appkr / OrderState.java
Created Aug 19, 2020
methods in Java Enum
View OrderState.java
// @see https://github.com/madvirus/ddd-start
public enum OrderState {
PAYMENT_WAITING {
public boolean isShippingChangeable() {
return true;
}
}, PREPARING {
public boolean isShippingChangeable() {
return true;
@appkr
appkr / DatabaseConfiguration.java
Created Mar 17, 2020
Spring Database Connection 분리
View DatabaseConfiguration.java
@Configuration
@EnableJpaRepositories("package.to.repository")
@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware")
@EnableTransactionManagement
public class DatabaseConfiguration {
private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class);
@Bean
@ConfigurationProperties(prefix = "spring.datasource.hikari.master")
View polymorphism.md
  • 부모 타입이 사용될 위치에 자식 타입을 사용하는 것
  • 부모 타입 대신 대입된 자식 타입이 재정의(override)한 메서드를 사용함으로써, 어떤 자식 타입이 대입되느냐에 따라서 그 실행 결과가 다양해질 수 있음
public class Foo {
    void doSomething() { /*어떤 동작*/ }
}

public class Bar extends Foo {
    @Override
    void doSomething() { /*다른 동작*/}
View Java random.md
(int) (Math.random() * A) + B

B 이상 (B + A) 미만의 랜덤 정수


example) 1~6 중 하나의 정수가 나오는 주사위