This file contains hidden or 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 com.github.kittinunf.kotlin2_0 | |
| import kotlinx.coroutines.flow.Flow | |
| import kotlinx.coroutines.flow.MutableSharedFlow | |
| fun example1() { | |
| // 1. | |
| /** | |
| * 1. Better operator and understanding code | |
| * |
This file contains hidden or 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
| open class Holder<out T: Any, in A>(creator: (A) -> T) { | |
| private var creator: ((A) -> T)? = creator | |
| @Volatile private var instance: T? = null | |
| fun instance(arg: A): T { | |
| val ins = instance | |
| if (ins != null) { | |
| return ins | |
| } |
This file contains hidden or 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
| class Solution { | |
| public: | |
| struct Position{ | |
| int row; | |
| int col; | |
| int cost; | |
| }; | |
| int toIndex(int M, int r, int c) { |
This file contains hidden or 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
| #include <iostream> | |
| #include <queue> | |
| #include <vector> | |
| using namespace std; | |
| vector<int> sortKMessedArray(const vector<int>& v, int k) { | |
| auto N = v.size(); | |
| if (N == 0) return {}; |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # fail if any commands fails | |
| set -eu | |
| # Requirements | |
| # - Set GITHUB_TOKEN as environment variable. | |
| # - This token must have `repo` permission and authorize kouzoh organization. | |
| if [[ $# -ne 2 ]]; then | |
| echo "Usage: ./script/merge_branch.sh BASE_BRANCH COMPARE_BRANCH" |
This file contains hidden or 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
| REMOTE_NAME=xxxxx | |
| git branch -r | grep "${REMOTE_NAME}/" | grep -v 'master$' | grep -v HEAD | sed -E "s/^[[:space:]]*${REMOTE_NAME}\///g" | while read line; do git push $REMOTE_NAME :heads/$line; done; |
This file contains hidden or 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
| import io.reactivex.Observable | |
| import io.reactivex.Scheduler | |
| import io.reactivex.annotations.CheckReturnValue | |
| import io.reactivex.disposables.Disposable | |
| import io.reactivex.schedulers.Schedulers | |
| import io.reactivex.subjects.PublishSubject | |
| interface Action | |
| interface State |
This file contains hidden or 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
| #include <string> | |
| #include <chrono> | |
| #include <thread> | |
| #include <iostream> | |
| using namespace std::chrono; | |
| auto calculation1(std::string d) { | |
| std::this_thread::sleep_for(seconds(5)); | |
| return "cal1_" + d; |
This file contains hidden or 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
| class RxJavaActivity : AppCompatActivity() { | |
| val cities = Observable.just("Warsaw", "Paris", "London", "Madrid", "Tokyo") | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_main) | |
| concatMap() | |
| // flatMap() |
NewerOlder