Skip to content

Instantly share code, notes, and snippets.

View kkdeok's full-sized avatar

Kideok kkdeok

  • Seoul, Republic of Korea
View GitHub Profile
@kkdeok
kkdeok / git_branch_terminal_prompt_for_zsh.md
Last active December 20, 2022 20:41
Git Branch Terminal Prompt for zsh (MacOS Catalina)

Git Branch Terminal Prompt for zsh (MacOS Catalina)

sample image

function parse_git_branch() {
    git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}

setopt PROMPT_SUBST
@kkdeok
kkdeok / Abstract Class
Created August 20, 2020 05:45
Template Method Pattern
public abstract class People {
public void printDailyRoutine() {
wakeUp();
work();
exercise();
}
public abstract void wakeUp();
public abstract void work();
public abstract void exercise();
@kkdeok
kkdeok / Singleton Pattern
Last active August 20, 2020 05:33
Design Pattern
class Singleton {
// As soon as field is declared, instance is created in the memory.
// It prevents exceptional case like multiple instances are created
// by multi-thread. We don't need to use keywork 'synchronize' in
// getInstance(). We just can ignore this case.
private static Singleton instance = new Singleton();
// private constructor
private Singleton() {}
@kkdeok
kkdeok / Lucene Searcher Exercise Code
Created October 30, 2019 11:34
Lucene Searcher Exercise Code
package com.doubleknd26.exercise.lucene.searcher;
/**
* Copyright Manning Publications Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@kkdeok
kkdeok / Lucene Indexer Exercise Code
Last active October 29, 2019 13:17
Lucene Indexer Exercise Code
/**
* Copyright Manning Publications Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
class Fruit {
private String name;
public Fruit(String name) {
this.name = name;
}
public String getName() {
return name;
}
/**
* Created by Kideok Kim on 17/06/2018.
*/
public class TCPServerTest {
private static ExecutorService serverExecutor;
private static final String HOST = "localhost";
private static final int PORT = 9001;
@BeforeClass
public static void setUpClass() {