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
| public static int getCurrentYear() { | |
| return Calendar.getInstance().get(Calendar.YEAR); | |
| } | |
| public static int[] getMonthsPos() { | |
| Calendar calendar = Calendar.getInstance(); | |
| calendar.add(Calendar.MONTH, 0); | |
| int month1 = new Timestamp(calendar.getTime().getTime()).getMonth(); |
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
| #ADB enable: | |
| adb tcpip 5555 | |
| adb connect device-ip:5555 | |
| #ADB to disable: | |
| adb -s device-ip:5555 usb |
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
| #start react-native in port 8088 | |
| $ react-native start --port=8088 | |
| #download the bundle of android know bug in react-native | |
| $ curl http://localhost:8088/index.android.bundle?platform=android | |
| #inside react-native's android project build the assembleRelease flavor | |
| $ ./gradlew assembleRelease | |
| #go to the apk's android folder |
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 OPHandleError { | |
| fun getError(code: Int): Throwable { | |
| val messageError: Throwable | |
| when (code) { | |
| //OpenPay General Errors | |
| 1000 -> messageError = Throwable("Error interno del servidor") | |
| 1001 -> messageError = Throwable("Error al identificar usuario, intenta nuevamente") | |
| 1002 -> messageError = Throwable("Error al identificar usuario, intenta nuevamente") | |
| 1003 -> messageError = Throwable("La operación no se pudo completar por que el valor de uno o más de los parametros no es correcto") |
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
| data class Galleta(val sabor: String, val chispas: 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
| import java.io.File | |
| import java.io.InputStream | |
| import kotlin.math.sqrt | |
| fun main(args: Array<String>) { | |
| val inputStream: InputStream = File("src/test_case.txt").inputStream() | |
| val lineList = mutableListOf<String>() | |
| inputStream.bufferedReader().useLines { lines -> |
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 kotlin.math.roundToInt | |
| fun main(args: Array<String>) { | |
| println("#2c79a5".alphaColor(0.5F)) | |
| println(getColorIntWithAlpha("#2c79a5",0.5F)) | |
| } | |
| fun getColorIntWithAlpha(hexColor: String, alpha: Float): Int = | |
| Color.parseColor(hexColor.alphaColor(alpha)) |
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 name:String? = null | |
| val l:Int = if(name != null) name.length else -1 | |
| print(l) // -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
| val name:String? = null | |
| val l:Int = name?.length ?: -1 | |
| print(l) // -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
| val name:String? = null | |
| var length:Int | |
| if(name != null){ | |
| length = name.length | |
| } else{ | |
| length = -1 | |
| } | |
| print(length) // -1 |