Skip to content

Instantly share code, notes, and snippets.

View ikhoon's full-sized avatar
๐Ÿฑ
Working from home

Ikhun Um ikhoon

๐Ÿฑ
Working from home
View GitHub Profile
@ikhoon
ikhoon / contributors.sh
Last active November 21, 2023 07:24
Extract Armeria contributors
#!/usr/bin/env bash
ARMERIA_DIR=??? # Path to Armeria project
RELEASE_NOTES_DIR=site/src/pages/release-notes
VERSIONS=$@
all=""
for version in $VERSIONS; do
current=`grep " '" $ARMERIA_DIR/$RELEASE_NOTES_DIR/$version.mdx | sed "s/[',]//g"`
all="$all$current"
done
/*
* Copyright 2023 LINE Corporation
*
* LINE Corporation licenses this file to you 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:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ikhoon
ikhoon / ServiceGroupTest.java
Last active July 6, 2023 15:22
Implementation of a service group that allows multiple services to be grouped together and bound to multiple prefixes.
package com.example.armeria;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@ikhoon
ikhoon / git-checkout-pr.sh
Last active May 4, 2023 09:30 — forked from trustin/git-checkout-pr.sh
git-checkout-pr.sh - fetches a Git pull request from the remote and creates a local branch for it
#!/usr/bin/env bash
set -Eeuo pipefail
log() {
echo -en '\033[1;32m'
echo -n "$@"
echo -e '\033[0m'
}
choice() {

์Šค์นผ๋ผ FP ๊ด€๋ จ ์ฑ…๋“ค

Scala Cookbook ์ €์ž๊ฐ€ ์”€, ๊ฐœ๋ฐœ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ FP์˜ ์—ญ์‚ฌ์™€ ๊ฐ™์€ ๋‚ด์šฉ๋„ ํฌํ•จ๋˜์–ด ์žˆ์Œ

ENSIME ๋ฉ”์ธ ๋ฉ”์ธํ…Œ์ด๋„ˆ๊ฐ€ ์”€ - scalaz๋ฅผ ํ™œ์šฉํ•˜์—ฌ FP๋กœ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ํ• ์ˆ˜ ์žˆ๋Š”๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ ์•Œ๋ ค์คŒ

์ผ๋ช… ๋นจ๊ฐ„ ์ฑ…์ด๋ผ ๋ถˆ๋ฆฌ๋ฉฐ, scala + FP์˜ ๋ฐ”์ด๋ธ” ๊ฐ™์€ ์กด์žฌ, ํ•˜์ง€๋งŒ ์–ด๋ ค์›€

#!/usr/bin/env bash
set -Eeuo pipefail
BREW='/opt/homebrew/bin/brew'
if [[ ! -x "$BREW" ]]; then
echo 'Install Homebrew first:'
echo
echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
echo
exit 1
@ikhoon
ikhoon / newmac.sh
Last active September 21, 2022 02:21
#!/bin/bash
# zsh
echo "Installing zsh..."
chsh -s `which zsh`
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
# homebrew, pip
echo "Installing homebrew, pip..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@ikhoon
ikhoon / Contravariant.scala
Last active June 10, 2022 05:59
์™œ ํ•จ์ˆ˜์˜ input์€ ๋ฐ˜๊ณต๋ณ€์„ฑ์ธ๊ฐ€?
// https://twitter.github.io/scala_school/type-basics.html
// ํŠธ์œ„ํ„ฐ ์Šค์นผ๋ผ ์Šค์ฟจ์— ๋‚˜์˜ค๋Š” ์ž๋ฃŒ๊ตฌ์กฐ๋ฅผ ํ™œ์šฉํ•ด๋ณด๊ฒ ๋‹ค.
class Animal { val sound = "rustle" }
class Bird extends Animal { override val sound = "call" }
class Chicken extends Bird { override val sound = "cluck" }
class Duck extends Bird { override val sound = "duck" }
def foo(tweet: Bird => String) = {
tweet(new Bird)
@ikhoon
ikhoon / test.json5
Created December 8, 2021 05:33
test.json5
{
// comments
unquoted: 'and you can quote me on that',
singleQuotes: 'I can use "double quotes" here',
lineBreaks: "Look, Mom! \
No \\n's!",
hexadecimal: 0xdecaf,
leadingDecimalPoint: .8675309, andTrailing: 8675309.,
positiveSign: +1,
trailingComma: 'in objects', andIn: ['arrays',],

Armeria on Scala

  • Unit ํƒ€์ž…์— ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜์˜ ๋ฐ˜ํ™˜๊ฐ’์„ ํ™•์ธํ•˜์ง€ ์•Š์œผ๋ฉด ์ปดํŒŒ์ผ๋Ÿฌ ์›Œ๋‹์ด ๋ฐœ์ƒํ•จ
  • Function<? super HttpService, ? HttpService> ํ˜•ํƒœ์˜ ์ผ ๊ฒฝ์šฐ์— Scala Function์—์„œ ๋ฐ”๋กœ ํ˜•๋ณ€ํ™˜์ด ๋˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— delegate => new MyHttpService(delegate) ๋ฅผ ํ•ด์ค˜์•ผ ํ•จ