Skip to content

Instantly share code, notes, and snippets.

View ahndwon's full-sized avatar
👋
Hi~~

homepodtaco ahndwon

👋
Hi~~
  • Seoul, South Korea
View GitHub Profile
@ahndwon
ahndwon / iterm2-solarized.md
Created October 8, 2021 05:29 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@ahndwon
ahndwon / brew_install.sh
Created August 2, 2021 05:02
brew install
#!/bin/bash
set -u
abort() {
printf "%s\n" "$@"
exit 1
}
if [ -z "${BASH_VERSION:-}" ]; then
abort "Bash is required to interpret this script."
#!/bin/bash
set -u
abort() {
printf "%s\n" "$@"
exit 1
}
if [ -z "${BASH_VERSION:-}" ]; then
abort "Bash is required to interpret this script."
@Suppress("UNCHECKED_CAST")
@BindingAdapter("itemsWithListAdapter")
fun <T, VH : RecyclerView.ViewHolder> setItemsWithListAdapter(
recyclerView: RecyclerView,
items: List<T>?
) {
(recyclerView.adapter as? ListAdapter<T, VH>)?.let { adapter ->
val newList = if (items == null || items.isEmpty()) null else ArrayList(items)
adapter.submitList(newList)
if (newList == null) {
#!/bin/sh
#
# This script should be run via curl:
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# or via wget:
# sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# or via fetch:
# sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#
# As an alternative, you can first download the install script and run it afterwards:
🌞 Morning 73 commits ▉░░░░░░░░░░░░░░░░░░░░ 4.5%
🌆 Daytime 644 commits ████████▎░░░░░░░░░░░░ 39.8%
🌃 Evening 691 commits ████████▉░░░░░░░░░░░░ 42.7%
🌙 Night 209 commits ██▋░░░░░░░░░░░░░░░░░░ 12.9%
inline fun <reified T : Fragment> FragmentManager.replaceFragment(
@IdRes containerViewId: Int,
vararg param: Pair<String, Any?>,
tag: String = T::class.java.simpleName
): T? {
return findFragment() ?: T::class.java.newInstance().also { newFragment ->
newFragment.arguments = bundleOf(*param)
beginTransaction()
.replace(containerViewId, newFragment, tag)
.commitAllowStateLoss()
inline fun <reified T : AppCompatActivity> Context.startActivity(
vararg extras: Pair<String, Any?>,
intentAction: Intent.() -> Unit = {}
) {
startActivity(Intent(this, T::class.java).apply {
putExtras(bundleOf(*extras))
intentAction()
})
}
@ahndwon
ahndwon / TextViewBindingAdapter.kt
Created September 23, 2020 12:16
TextViewBindingAdapter
@BindingAdapter("textResId")
fun TextView.setStringResId(@StringRes value: Int) {
if (value == 0) return
setText(value)
}
@BindingAdapter("textColorResId")
fun TextView.setTextColorResId(@ColorRes value: Int) {
if (value == 0) return
setTextColor(ContextCompat.getColor(context, value))
@ahndwon
ahndwon / android_studio_complete_removal.txt
Last active June 14, 2020 09:40
Android Studio complete removal after application delete
rm -Rf ~/Library/Preferences/AndroidStudio
rm -Rf ~/Library/Preferences/com.google.android
rm -Rf ~/Library/Preferences/com.android
rm -Rf ~/Library/Application/Support/AndroidStudio
rm -Rf ~/Library/Logs/AndroidStudio
rm -Rf ~/Library/Caches/AndroidStudio