Skip to content

Instantly share code, notes, and snippets.

@Jeevuz
Jeevuz / Extensions.kt
Last active January 3, 2023 10:25
Here I collect some of my most useful Kotlin extensions
inline fun SharedPreferences.edit(changes: SharedPreferences.Editor.() -> SharedPreferences.Editor) {
edit().changes().apply()
}
fun ImageView.tintSrc(@ColorRes colorRes: Int) {
val drawable = DrawableCompat.wrap(drawable)
DrawableCompat.setTint(drawable, ContextCompat.getColor(context, colorRes))
setImageDrawable(drawable)
if (drawable is TintAwareDrawable) invalidate() // Because in this case setImageDrawable will not call invalidate()
}
@margaretmz
margaretmz / set up adb on Mac
Last active November 17, 2020 19:19
How to set up adb environment variable on Mac
// Step 1. Open or create the .bash_file
// Open .bash_file
$ -a TextEdit ~/.bash_profile
// create the file if it doesn’t exist:
$ touch ~/.bash_profile
// Step 2. Add path to adb tool (note your path maybe different)
export PATH=$PATH:/Users/Margaret/Library/Android/sdk/platform-tools/
// Step 3. Make the new path in effect
@lopspower
lopspower / README.md
Last active June 16, 2024 11:11
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@mandiwise
mandiwise / Update remote repo
Last active May 28, 2024 03:03
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket