Skip to content

Instantly share code, notes, and snippets.

View masadchattha's full-sized avatar
:octocat:
Coding

Muhammad Asad Chattha masadchattha

:octocat:
Coding
View GitHub Profile
@masadchattha
masadchattha / SpeechRecognizer.swift
Created March 7, 2023 19:36
Transcribing Live Audio Speech to text in SwiftUI.
/*
Transcribing speech to text
Captures and logs meeting transcripts.
You’ll request access to device hardware like the microphone and
integrate the Speech framework to transcribe live audio to text.
*/
import AVFoundation
import Foundation
import Speech
@masadchattha
masadchattha / colors.xml
Last active June 29, 2020 08:58
Reuse Drawable color resources for Android article on medium.com
<!-- Circle color for number 1 -->
<color name="number1">#4A7BA7</color>
<!-- Circle color for number 2 -->
<color name="number2">#04B4B3</color>
<!-- Circle color for number 3 -->
<color name="number3">#F5A623</color>
<!-- Circle color for default case -->
@masadchattha
masadchattha / MainActivity.java
Last active June 30, 2020 15:58
Reuse Drawable java file for Android article on medium.com
package com.asadchattha.reusedrawable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
@masadchattha
masadchattha / activity_main.xml
Last active June 29, 2020 08:55
Reuse Drawable layout file for Android article on medium.com
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:context=".MainActivity">