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
pub fn cbc_decryption(key_stream: &[u8], cipher: &[u8], init_vector: &[u8]) -> Vec<u8> { | |
let mut res = Vec::new(); | |
let chunked: Vec<&[u8]> = cipher.chunks(16).collect(); | |
chunked | |
.iter() | |
.enumerate() | |
.for_each(|(index, cipher_chunk)| { | |
let last = if index == 0 { | |
init_vector | |
} else { |
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
@Composable | |
fun RandomBox() { | |
Row( | |
verticalAlignment = Alignment.CenterVertically, | |
modifier = Modifier | |
.height(IntrinsicSize.Min) | |
.padding(100.dp) | |
.border(width = 1.dp, shape = RoundedCornerShape(6.dp), color = Color.Gray) | |
) { | |
for (i in 1..4) { |
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
enum class Player { | |
X, O | |
} | |
class Board { | |
private val slots = "1,2,3,4,5,6,7,8,9".split(",").toTypedArray() | |
fun show() { | |
for ((index, item) in slots.withIndex()) { | |
print(item) |
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 Char.isVowel(): Boolean { | |
return "aeiou".contains(lowercaseChar()) | |
} | |
fun String.toPigLatin(): String { | |
if (isEmpty()) return this | |
if (this[0].isVowel()) { | |
return this + "way" | |
} |
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 main() { | |
for (i in 1 .. 100) { | |
when { | |
i % 3 == 0 && i % 5 == 0 -> println("CracklePop") | |
i % 3 == 0 -> println("Crackle") | |
i % 5 == 0 -> println("Pop") | |
else -> println(i) |
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
@SuppressLint("ViewConstructor") | |
class AndroidComposeView @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0, | |
// add extra params here | |
) : AbstractComposeView(context, attrs, defStyleAttr) { | |
@Composable | |
override fun Content() { |
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
@Composable | |
fun MultipleProgressBar(steps: Int = 4, currentStep: Int) { | |
Row( | |
verticalAlignment = Alignment.CenterVertically, modifier = Modifier | |
.height(48.dp) | |
.fillMaxWidth() | |
.padding(24.dp, 0.dp), | |
horizontalArrangement = Arrangement.SpaceBetween | |
) { | |
for (index in 0 until steps) { |
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
static void ReadFile(String filePath) { | |
ArrayList<String> messageTypeList = new ArrayList<>(); | |
ArrayList<String> transactionTypeList = new ArrayList<>(); | |
ArrayList<String> responseCodeList = new ArrayList<>(); | |
ArrayList<String> systemTraceList = new ArrayList<>(); | |
try (BufferedReader oBufferedReader = new BufferedReader(new FileReader(filePath))) { | |
String strLine; | |
oBufferedReader.readLine(); // skips the first line | |
// |
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 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_bloc/flutter_bloc.dart'; | |
class ViewProfileScreen extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( |
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
<string-array name="CountryCodes"> | |
<item>93,AF</item> | |
<item>355,AL</item> | |
<item>32,BE</item> | |
<item>269,KM</item> | |
<item>682,CK</item> | |
<item>213,DZ</item> | |
<item>501,BZ</item> | |
<item>506,CR</item> | |
<item>1-684,AS</item> |