This file contains 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 parse, { Element } from "html-react-parser"; | |
import { TestCard } from "./test-card"; | |
function addTestCard(html: string): string { | |
// Define a regular expression pattern to match [template id="some-id-in-number"] | |
const templateRegex = /\[template id="(\d+)"]/g; | |
const replacedHTML = html.replace(templateRegex, (match, id) => { | |
return `<div id="test_card" tag=${id} />`; | |
}); |
This file contains 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
.input-wrapper { | |
--padding: 16px; | |
--focus-color: black; | |
position: relative; | |
display: flex; | |
align-items: center; | |
} | |
input { | |
padding: var(--padding); |
This file contains 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
<div class="input-wrapper"> | |
<input type='text' id='input' required ></input> | |
<label | |
for='input' | |
class='placeholder'> | |
Username | |
</label> | |
</div> |
This file contains 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
//Make sure to handle read SMS permission before calling this function | |
fun getSmsCountByNumber(senderNumber:String) : Int{ | |
var totalSMS = 0 | |
val countryCode = "+91" | |
applicationContext.contentResolver.query( | |
Telephony.Sms.CONTENT_URI, | |
null, | |
null, |
This file contains 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 Emoji { | |
val smiley = getEmojiByUnicode(0x1F60A) | |
val heart = getEmojiByUnicode(0x2764) | |
val loveFace = getEmojiByUnicode(0x1F60D) | |
val funnyFace = getEmojiByUnicode(0x1F602) | |
val yummyFace = getEmojiByUnicode(0x1F60B) | |
val claps = getEmojiByUnicode(0x1F44F) | |
val fire = getEmojiByUnicode(0x1F525) | |
val angryFace = getEmojiByUnicode(0x1F621) |
This file contains 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 getAllAudioFiles(): MutableList<String> { | |
val songs: MutableList<String> = ArrayList() | |
val selection = MediaStore.Audio.Media.IS_MUSIC + " != 0" | |
val projection = arrayOf( | |
MediaStore.Audio.Media._ID, | |
MediaStore.Audio.Media.ARTIST, | |
MediaStore.Audio.Media.TITLE, | |
MediaStore.Audio.Media.DATA, | |
MediaStore.Audio.Media.DISPLAY_NAME, | |
MediaStore.Audio.Media.DURATION |
This file contains 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
//Demo | |
fun demo(){ | |
tryAndCatch { | |
// doSomething() | |
} | |
} | |
//Utility Function for Simple Try and Catch use | |
fun tryAndCatch(tryThis:(()->Unit)){ | |
try{ |