Skip to content

Instantly share code, notes, and snippets.

View hellofaizan's full-sized avatar
👨‍💻
Writing Code For Errors

Mohammad Faizan hellofaizan

👨‍💻
Writing Code For Errors
View GitHub Profile
@hellofaizan
hellofaizan / ytimg.js
Created March 7, 2023 15:34 — forked from dustinrouillard/ytimg.js
CloudFlare worker for first available YouTube thumbnail (maxresdefault or hqdefault)
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
});
async function fetchImage(id, type = 'maxresdefault') {
const req = await fetch(`https://i.ytimg.com/vi/${id}/${type}.jpg`);
if (req.status != 200) return await fetchImage(id, 'hqdefault');
return req;
};
@hellofaizan
hellofaizan / ChapterInfoActivity.kt
Created February 2, 2023 06:10 — forked from ikhlaqmalik13/ChapterInfoActivity.kt
API Integration With Kotlin for Getting Quranic Surah's
package com.maple.kashin.learning
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.text.Html
import android.util.Log
import android.widget.Toast
import com.maple.kashin.databinding.ActivityChapterInfoBinding
import com.maple.kashin.learning.models.ChapterInfo
import com.maple.kashin.learning.models.QuranicChapterInfoResponseModel
@hellofaizan
hellofaizan / Load Image From Firebase Real Time Database
Created June 16, 2022 11:35
Load Image From Firebase Real Time Database
// Load NavBar Image From Firebase
DatabaseReference getImage = databaseReferenceImage.child("NavBarImage");
getImage.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
// getting a DataSnapshot for the location at the specified
// relative path and getting in the link variable
String link = dataSnapshot.getValue(String.class);
// loading that data into rImage
@hellofaizan
hellofaizan / Leap Year Java Logic
Created November 9, 2021 01:28
Algorithms behind checking whether any given year is leap year or not | Curious Faizan
public class Main {
public static void main(String[] args) {
// year to be checked
int year = 1996;
boolean leap = false;
// if the year is divided by 4
if (year % 4 == 0) {