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.view.View | |
| import android.view.ViewGroup | |
| import androidx.core.view.ViewCompat | |
| import androidx.core.view.WindowInsetsCompat | |
| import androidx.core.view.updateMargins | |
| import androidx.core.view.updatePadding | |
| import com.example.R | |
| fun View.addStatusBarPadding() { | |
| ViewCompat.setOnApplyWindowInsetsListener(this) { v, insets -> |
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
| void scanScreenAddress() { | |
| Wire.begin(); | |
| Serial.begin(4800); | |
| while (!Serial) | |
| ; // Needed for some cards, No problem for Nano | |
| Serial.println("Scanning I2C devices..."); | |
| byte count = 0; | |
| for (byte addr = 1; addr < 127; addr++) { |
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
| #include <iostream> | |
| uint8_t mod256(uint16_t value) { | |
| return static_cast<uint8_t>(value % 256); | |
| } | |
| int main() { | |
| uint16_t sum = 0x02+ 0x01+ 0x00+0xFF+ 0xFF; | |
| uint8_t result = mod256(sum); | |
| std::cout <<std::hex<< static_cast<int>(result) << std::endl; | |
| return 0; | |
| } |
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.util.Base64 | |
| import android.util.Base64InputStream | |
| import org.apache.commons.io.input.ReaderInputStream //implementation 'commons-io:commons-io:2.19.0' https://central.sonatype.com/artifact/commons-io/commons-io?smo=true | |
| import tr.com.avivasa.mobileapp.base.BasePresenter | |
| import java.io.StringReader | |
| import java.nio.charset.StandardCharsets | |
| val base64String = "someBase64String" | |
| val inputStream = Base64InputStream( | |
| ReaderInputStream.builder() |
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.graphics.Typeface | |
| import android.text.Annotation | |
| import android.text.SpannedString | |
| import android.text.style.ForegroundColorSpan | |
| import android.text.style.StrikethroughSpan | |
| import android.text.style.StyleSpan | |
| import android.text.style.UnderlineSpan | |
| import androidx.annotation.StringRes | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.ui.graphics.Color |
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.content.Intent | |
| import android.net.Uri | |
| import android.os.Handler | |
| import android.os.Looper | |
| import android.os.ParcelFileDescriptor | |
| import androidx.activity.ComponentActivity | |
| import androidx.activity.result.ActivityResultLauncher | |
| import androidx.activity.result.contract.ActivityResultContracts | |
| import timber.log.Timber | |
| import java.io.ByteArrayInputStream |
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 <T : Any> T.equalsAtLeastOne(arg1: T? = null, arg2: T? = null, arg3: T? = null): Boolean { | |
| return this == arg1 || this == arg2 || this == arg3 | |
| } |
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.contracts.ExperimentalContracts | |
| import kotlin.contracts.contract | |
| @OptIn(ExperimentalContracts::class) | |
| fun allNotNull( | |
| arg1: Any?, | |
| arg2: Any?, | |
| arg3: Any? = Any(), | |
| arg4: Any? = Any(), | |
| arg5: Any? = Any() |
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 CommandLine { | |
| static execute(String command) { | |
| command.execute().waitForProcessOutput(System.out, System.err) | |
| } | |
| } |
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
| object HexToBase64 { | |
| fun encode(hex: String): String { | |
| return Base64.getUrlEncoder().encodeToString(hex.decodeHex()) | |
| } | |
| private fun String.decodeHex(): ByteArray { | |
| check(length % 2 == 0) { "Must have an even length" } | |
| return chunked(2) |
NewerOlder