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
// A problem like destructuring declarations | |
// by Maria Neumayer | |
// https://medium.com/a-problem-like-maria/a-problem-like-destructuring-declarations-95f10375ea8a | |
data class Song( | |
val artist: String, | |
// val album: String, // once this line gets uncommented | |
val name: String | |
) |
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 BaseRecyclerViewHolder(@LayoutRes layoutRes: Int, viewGroup: ViewGroup) : RecyclerView.ViewHolder(inflate(layoutRes, viewGroup)) { // Use the private companion function inflate() for getting a view instance. | |
companion object { | |
fun inflate(@LayoutRes layoutRes: Int, viewGroup: ViewGroup): View { | |
return LayoutInflater.from(viewGroup.context).inflate(layoutRes, viewGroup, false) | |
} | |
} | |
} |
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
// Something you don't know about Android's LayoutInflater | |
// by Abhishek Jangra | |
// https://medium.com/@iabhishek1041/something-you-dont-know-about-android-layoutinflater-6de7709289ac | |
val inflater: LayoutInflater = LayoutInflater.from(this) | |
// When attachToRoot is true, the generated view from the a_view XML will automatically attached to the rootView, | |
// but it will not return the inflated view but the rootView itself. | |
val rootViewReference = inflater.inflate(R.layout.a_view, rootView, attachToRoot = true) |
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
# call system commands from python | |
import subprocess | |
s = "some test" | |
subprocess.call(["shutdown", "-s", "-t", "10", "-c", s]) |
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
# shows the apk's certificate | |
keytool -list -printcert -jarfile <apk> | |
# shows the keystore details | |
keytool -list -v -keystore release.jks |
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
# !/bin/sh | |
# Easy checkout of branch using grep. | |
# | |
# example: chkBranch 1789 | |
# or: chkBranch ZAC-4 | |
git pull | |
count=`git branch | grep -c $1` |
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
#!/bin/bash | |
# | |
# Shows all remote branches and their age. | |
# | |
# Passing -n <name_of_commiter> shows only the branches last touched by that person. | |
# Passing -b <branch> shows only branches of that type (release, feature, experimental, etc) | |
# Passing -t <time> (day, week, month, year) | |
# | |
# Arguments can be combined. |
NewerOlder