Skip to content

Instantly share code, notes, and snippets.

View zetazaw's full-sized avatar
🛌
Sleeping at Home

Ko Nyan zetazaw

🛌
Sleeping at Home
View GitHub Profile
[
{
"label": "Chrome",
"packageName": "com.android.chrome",
"visible": true,
"enable": false
},
{
"label": "POS Steward",
"packageName": "com.woyou.hardwarekeeper",
@zetazaw
zetazaw / descoder.kt
Last active July 8, 2020 07:57
Kotlin 3DES Encrypt Decrypt
val ByteArray.asHexLower inline get() = this.joinToString(separator = ""){ String.format("%02x",(it.toInt() and 0xFF))}
val ByteArray.asHexUpper inline get() = this.joinToString(separator = ""){ String.format("%02X",(it.toInt() and 0xFF))}
val String.hexAsByteArray inline get() = this.chunked(2).map { it.toUpperCase().toInt(16).toByte() }.toByteArray()
val String.tryHexAsByteArray inline get() = try{this.chunked(2).map { it.toUpperCase().toInt(16).toByte() }.toByteArray()}catch(e:Throwable){null}
fun encrypt3Des(data: String): String{
val dataBytes = data.hexAsByteArray
var keyBytes = key.hexAsByteArray
if (keyBytes.size == 16){
val tmpKey = ByteArray(24)
abstract class GenericAdapter<T>(val items: List<T>,
val layoutResId: Int,
val bindHolder: View.(T) -> Unit) :
RecyclerView.Adapter<GenericAdapter.Holder>() {
override fun getItemCount(): Int = items.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder {
val view = LayoutInflater.from(parent.context).inflate(layoutResId, parent, false)
return Holder(view)
/**
* The `fragment` is added to the container view with id `frameId`. The operation is
* performed by the `fragmentManager`.
*/
fun AppCompatActivity.replaceFragmentInActivity(fragment: Fragment, @IdRes frameId: Int) {
supportFragmentManager.transact {
replace(frameId, fragment)
}
}
@zetazaw
zetazaw / BaseAdapter.kt
Created January 16, 2018 08:29
Kotlin Android Recycler Adapter
package your.package.name
import android.support.v7.util.DiffUtil
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
/**
@zetazaw
zetazaw / 2c2p
Created November 20, 2017 12:04
My2c2pSDK sdk = new My2c2pSDK("MIAGCSqGSIb3DQEHA6CAMIACAQAxggGoMIIBpAIBADCBizB+MQswCQYDVQQGEwJTRzELMAkGA1UECBMCU0cxEjAQBgNVBAcTCVNpbmdhcG9yZTENMAsGA1UEChMEMmMycDENMAsGA1UECxMEMmMycDEPMA0GA1UEAxMGbXkyYzJwMR8wHQYJKoZIhvcNAQkBFhBsdXNpYW5hQDJjMnAuY29tAgkA6a0e/lQFe58wDQYJKoZIhvcNAQEBBQAEggEAGMdlepae0qiHnF+dUehI49PdsH2Wr3aHoSjBvPFzKVcGNjYHEGOb8dJ40jpIIruiVUpkusI0M5zJU5icBBnSN/A3HCCyiaR/XlxqmyyjWns/Zk9VgVUVP+ewjzhtxJJS49OwQU1VhUc/IFk+gpUQpsEJhaShMJ6Mb09Ei04lDnv5xxMkt0MjmOgIp7Jfz7xCTUXwg3AZ1eUUEoTAtpzjoMqxhXnohxxTeam3ssJZdM0+pLwmmDiltNAYkn47o7Rww1w9Lu0j6gL2ikMtlkaZ7QRwV9ItbmAnCmXKXb0gjz3dvTzPbuvvertwunjMd2TDPc/Sv839jkybv47UN0B65jCABgkqhkiG9w0BBwEwHQYJYIZIAWUDBAECBBBhkOu4ziTjJ+JLAf24bNs0oIAEggPochZHMOIhDUAz2XHl/J9QA1gueOLqd11315a5haiAUUOc6UfmSQpyvUh+CKRFp720RoYmx9bCDRa6wL65g8SX8Rcl2lzO45hQzGYHGB0Q5Rytnf8SbzENtj2BXujuDF0t7jn++JO0YVhqwB/dasW6maOeYnWqckv+kltTpILJ51sYbZV5gCbIVKzMyQmZef4rmVlbgCQe/CkBx7YCIVgO/GD47dedM53zKwlhjxvaOPhuYh+JaO/PYEHtcyfmEETslUoGAPdhxprmD6sKh23Jft26aapPA6vQx9AbbztUPURkI4c7oo4XRJqIddNoJdg+Xsuw9Gw9u
@zetazaw
zetazaw / kotlin_articles
Created November 17, 2017 11:56
good articles related with kotlin
https://www.bignerdranch.com/blog/want-kotlin-on-the-server-do-ktor/
__________
Mobile App Architecture
One of the first steps for development of an app in a mobile application development company is selecting the right client architecture. We assist selecting right client architecture amongst “Mobile Web App”, “Native App”, “Hybrid App” approaches considering several unique aspects like device form factor, sporadic connectivity, variable bandwidth, multi-platform support, and user experience. Also, we assess mobile client architecture approaches by comparing them along with key technical and business drivers like multi-platform support, access to device sensors, performance, native look and feel, app search, app distribution, app upgrades, connectivity and development/testing effort, time-to-market, budget, TCO, consumer perception and BYOD.
Key Technical Criteria For Evaluating Mobile Architectures:
Access To Mobile Hardware Sensors
Performance
Native Look And Feel
nocturnal.ninja
nocturnalfox.ninja
nocturnalfox.net
public class DateTimeUtil {
private DateTimeUtil() {
}
private static final String APPLY_FORMAT_DATE = "yyyy-MM-dd";
private static final String APPLY_FORMAT_TIME = "HH:mm:ss";
//private static final String APPLY_FORMAT_FULL = APPLY_FORMAT_DATE + APPLY_FORMAT_T + APPLY_FORMAT_TIME;