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. |
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
# 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
# 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
// 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
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
// 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
// Understanding Handler and Looper in Android | |
// by Rahul Rastogi | |
// https://medium.com/@rastogi.tech/understanding-handler-and-looper-in-android-c6fa673c6822 | |
var handler: Handler? = null | |
Thread { | |
Looper.prepare() // Creating a Looper for this thread. | |
// Creating a Handler for given Looper object. |
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
apply plugin: 'com.android.application' | |
apply plugin: 'android-apt' | |
android { | |
compileSdkVersion versions.compileSdk | |
buildToolsVersion versions.buildTools | |
defaultConfig { | |
applicationId "samples.linhtruong.com.ui_reactive_rxjava_realm" | |
minSdkVersion versions.minSdk |
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
val matrix = Matrix() | |
val srcIndex = 0 | |
val dstIndex = 0 | |
val pointCount = 4 // or any other number of points you wanna transform | |
/** | |
* Set the matrix such that the specified src points would map to the specified dst points. The | |
* "points" are represented as an array of floats, order [x0, y0, x1, y1, ...], where each | |
* "point" is 2 float values. | |
*/ |
OlderNewer