[변수] instanceof Function을 활용하여 체크한다. typeof [변수] === 'function'도 사용할 수 있다. 사용 예시 function callFunctions(init, ...functions) { return functions.reduce((acc, func) => { if(func instanceof Function) return func(acc); else throw new Error(`${func} is not Function`); }, init); } try { const result = callFunctions( 1, value => value *= 100, value => value += 2, // 3, value => value -= 22, console.log,..
Correct way to convert size in bytes to KB, MB, GB in JavaScript I got this code to covert size in bytes via PHP. Now I want to convert those sizes to human readable sizes using JavaScript. I tried to convert this code to JavaScript, which looks like this: fun... stackoverflow.com 리마인드용으로 작성
Java 7에서 추가된 메소드이다. 첫 번째 인자로 받은 객체의 null 여부를 검사하여 다음과 같이 동작한다. null이 아닌 경우: 해당 객체를 그대로 반환한다. null인 경우: NPE를 발생시킨다. 두 번째 인자에 문자열을 입력하여 NPE의 메시지를 설정할 수 있다. public class Main { public static void main(String[] args) { String nullString = null; // String nullString = "null"; String checked = Objects.requireNonNull(nullString, "널이에용"); System.out.println(checked); } } 위 코드의 주석을 변경하면 checked는 null이라는 ..
public class Study { public static void main(String[] args) { for(Animals animal : Animals.values()) { animal.greeting(); animal.move(); } } } enum Animals { HUMAN(1.11) { @Override public void move() { System.out.println("move with human"); } }, BIRD(1, "Birdie"){ @Override public void move() { System.out.println("fly with bird"); } }, DOG(2, "Doggo"){ @Override public void move() { System.out...
JDK 1.5부터 추가된 개념이다. 부모 클래스의 메소드를 오버라이딩하는 경우, 부모 클래스의 반환 타입은 자식 클래스의 타입으로 변경이 가능하다. public class Main { public static void main(String[] args) { Parent parent = new Parent(); Child child = new Child(); Parent pc = new Child(); System.out.println(parent.createNewOne().getClass()); System.out.println(child.createNewOne().getClass()); System.out.println(pc.createNewOne().getClass()); } } class Paren..
문자열(String) 문자열 읽어들이기 주로 백준에서 사용하는 방식이다. 공백이 포함된 문자는 반드시 nextLine을 사용하자. Scanner scanner = new Scanner(System.in); String input = scanner.next(); // String input = scanner.nextLine(); 문자열의 모든 문자 순회하기 향상된 for 문이 가독성이 더 좋다. 향상된 for 문의 우항에는 Iterable 또는 배열을 배치한다. String test = "Hello World!"; for(int i = 0; i < test.length(); i++) System.out.println(test.charAt(i)); // 또는 String temp = "Hello World!..
참고사항 GitHub - etiennestuder/gradle-jooq-plugin: Gradle plugin that integrates jOOQ. Gradle plugin that integrates jOOQ. . Contribute to etiennestuder/gradle-jooq-plugin development by creating an account on GitHub. github.com
[~] git rebase -i HEAD~2 2개의 커밋 메시지를 합치는 경우이므로 HEAD~2로 작성한다. vi 편집기 창이 자동으로 활성화되며, 다음과 같은 기준으로 수정한후 :wq로 저장한다. pick: 합치는 기준이 될 커밋. s: squash이며, pick 커밋을 기준으로 합쳐서 없애고자 하는 커밋. vi 편집기 창이 하나 더 활성화되며, 커밋 메시지를 새로 작성한 후 :wq로 저장한다. 합쳐질 커밋 메시지가 둘이라면, 둘 모두가 편집기에 자동으로 작성되어 있는 상태이다. 커밋 메시지를 적절히 수정한 후 저장하도록 하자.
- Total
- Today
- Yesterday
- pgloader
- mysql
- kotlin
- 코딩테스트
- hashicorp
- react
- JEST
- Node.js
- eureka
- AWS
- Docker
- Gradle
- terraform
- Vault
- Java
- RancherDesktop
- spring boot
- Git
- javascript
- JPA
- postgresql
- Linux
- Puppeteer
- AWS IoT
- etc
- jQuery
- Database
- IntelliJ
- shell
- Spring Cloud Config
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |