Skip to content

Instantly share code, notes, and snippets.

View Ayubur's full-sized avatar
🎯
Focusing

Ayubur Rahaman Ayubur

🎯
Focusing
  • Dhaka, Bangladesh
  • 20:29 (UTC -12:00)
View GitHub Profile
@Ayubur
Ayubur / ExternalAPIService.js
Created February 25, 2025 16:43
Utility function to validate apple identity token and return back apple userid using apple identity token and userid
const APPLE_KEYS_URL = "https://appleid.apple.com/auth/keys";
const APPLE_ISS_URL = "https://appleid.apple.com";
const validateAppleIdentityToken = async (identityToken, appleUserId) => {
const { data } = await axios.get(APPLE_KEYS_URL);
const applePublicKey = data;
const tokenDecodedHeader = jwtDecode(identityToken, { header: true });
const kid = tokenDecodedHeader.kid;
const sharedKid = applePublicKey.keys.filter((x) => x["kid"] === kid)[0]?.[
@Ayubur
Ayubur / RNSemiCircularProgressBar.js
Last active February 25, 2025 16:44
React Native Semi Circular Progress bar
import React, { useEffect, useState } from 'react'
import { Animated, View, StyleSheet } from 'react-native'
const CustomSemiCircleProgress = ({
children,
animationSpeed = 2,
initialPercentage = 0,
percentage = 10,
minValue,
@Ayubur
Ayubur / upload.php
Last active August 9, 2021 05:58
PHP Single Image Upload REST API
<?php
// Include the database configuration file
include '/server/connection.php';
if(is_uploaded_file($_FILES['file']['tmp_name'])){
// File upload path
$targetDir = "../uploads/";
$file=$_FILES['file']['tmp_name'];
@Ayubur
Ayubur / mobileNumberValidator.js
Last active February 9, 2023 15:20
Javascript mobile number validation RegExp example
//RegExp of mobile number validtion
let countryCode = '880'; //mobile country code
let numberLength=10; //length of mobile number
let mobilePattern = `^((\\+${countryCode}-?)|0)?[0-9]{${numberLength.toString()}}$`;