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
| 1. Download Git Bash (only if on Windows) | |
| 2. Go to your users folder and open the .ssh folder. Then open Git Bash / Terminal there and generate a key pair: | |
| ssh-keygen -m PEM -t rsa | |
| 3. Copy the key to your server: | |
| ssh-copy-id -i <keyname> <user>@<host> | |
| 5. Login to your Ubuntu server via SSH: | |
| ssh -i <keyname> <user>@<host> |
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
| fun Int.toCharArray(): String { | |
| var s = "" | |
| var t = 0 | |
| var num = this + 1 | |
| while ( num > 0) { | |
| t = (num - 1) % 26 | |
| s = (65 + t).toChar().toString() + s | |
| num = (num - t) / 26 or 0 | |
| } | |
| return 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
| import android.annotation.SuppressLint | |
| import java.text.ParseException | |
| import java.text.SimpleDateFormat | |
| import java.util.* | |
| import java.util.Calendar.MILLISECOND | |
| import java.util.concurrent.TimeUnit | |
| /** | |
| * Created by fizhu on 05,June,2020 |
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
| class MaterialDatePickerWithValidators { | |
| private fun showDatePicker() { | |
| val dateMin = getDays(-15) | |
| val dateMax = getDays(+15) | |
| val calendarConstraints = CalendarConstraints.Builder() | |
| .setStart(dateMin.time) | |
| .setEnd(dateMax.time) | |
| .setValidator( | |
| CompositeDateValidator.allOf( |
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
| fun Double.toRupiah(): String { | |
| val localeID = Locale("in", "ID") | |
| val numberFormat = NumberFormat.getCurrencyInstance(localeID) | |
| numberFormat.maximumFractionDigits = 0 | |
| return numberFormat.format(this).toString() | |
| } |
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 gson = Gson() | |
| val listClazz = mutableListOf<Clazz>() | |
| val arry: JsonArray = JsonParser().parse(gson.toJson(it.result)).asJsonArray | |
| for (jsonElement in arry) { | |
| listClazz.add(gson.fromJson(jsonElement, Clazz::class.java)) | |
| } |