Skip to content

Instantly share code, notes, and snippets.

View alaminfirdows's full-sized avatar
🎯

Al-Amin Firdows alaminfirdows

🎯
View GitHub Profile
@alaminfirdows
alaminfirdows / outbound-email-with-cloudflare.md
Created January 24, 2024 07:20 — forked from irazasyed/outbound-email-with-cloudflare.md
Using Gmail SMTP with Cloudflare Email Routing: A Step-by-Step Guide

Using Gmail SMTP with Cloudflare Email Routing: Step-by-Step Guide

Learn how to send emails through Gmail SMTP with Cloudflare Email Routing in this comprehensive guide.

Step 1: Enable 2-Factor Authentication

To proceed with this method, ensure that you have enabled two-factor authentication for your Google account. If you haven't done so already, you can follow the link to set it up → Enable 2FA in your Google account.

Step 2: Create an App Password for Mail

<?php
$country_list = [
[
"name" => "Afghanistan",
"currency" => "AFN",
"continent" => "AS",
"code" => "AFG",
],
[
export const countriesFlag = [
{
emoji: '🇦🇫',
code: 'AF',
},
{
emoji: '🇦🇽',
code: 'AX',
},
{
@alaminfirdows
alaminfirdows / CopyToClipboard.ts
Created December 30, 2023 08:18
This JavaScript function, copyToClipboard, facilitates easy text copying to the clipboard. It first checks for compatibility with the modern Clipboard API in secure contexts. If supported, it uses the API for asynchronous clipboard writes. In cases where the API is unavailable or the context is not secure, it employs the 'out of viewport hidden …
export const copyToClipboard = async (textToCopy: string) => {
// Navigator clipboard api needs a secure context (https)
if (navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(textToCopy);
} else {
// Use the 'out of viewport hidden text area' trick
const textArea = document.createElement('textarea');
textArea.value = textToCopy;
// Move textarea out of the viewport so it's not visible
export const copyToClipboard = async (textToCopy) => {
// Navigator clipboard api needs a secure context (https)
if (navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(textToCopy);
} else {
// Use the 'out of viewport hidden text area' trick
const textArea = document.createElement('textarea');
textArea.value = textToCopy;
// Move textarea out of the viewport so it's not visible
@alaminfirdows
alaminfirdows / ExampleServiceProvider.php
Last active October 19, 2022 05:14
Example Service Provider for WPSmartPay
<?php
namespace Example\Providers;
use SmartPay\Framework\Support\ServiceProvider;
class ExampleServiceProvider extends ServiceProvider
{
public function register()
{
@alaminfirdows
alaminfirdows / leetcode-238-solution.php
Last active September 29, 2025 04:48
LeetCode - 238. Product of Array Except Self
<?php
class Solution {
/**
* @param Integer[] $numbers
* @return Integer[]
*/
function productExceptSelf($numbers) {
$answer = [];
@alaminfirdows
alaminfirdows / nano-id.es6.js
Last active August 29, 2024 05:57
Generate nano ID with length by TS, ES6 or JS
const nanoid = (length = 10) => {
let id = '';
while (id.length < length) {
id += 'ABCDEFGHIJKLMNPQRSTUVWXYZ123456789'.charAt(Math.floor(Math.random() * 34));
}
return id;
};
@alaminfirdows
alaminfirdows / convert-json-object-to-form-data-es6.js
Last active August 10, 2022 17:03
Convert json object to form data. Available for TS, ES6 Module, and JS
"use strict";
/**
* Convert json object to FormData
*
* @param data
* @param options
* @returns FormData
*/
const jsonObjectToFormaData = (data, formData = new FormData()) => {
convertRecursively(data, formData);
@alaminfirdows
alaminfirdows / bubble.html
Last active August 1, 2022 09:21
Tailwindcss typing bubble animation
<div class="p-10">
<div class="flex items-center space-x-3 text-gray-600 text-sm">
<div class="flex h-full items-center space-x-1">
<div class="h-5 animate-bounce animation-delay-200">
<div class="h-1.5 w-1.5 rounded-full bg-gray-400"></div>
</div>
<div class="h-5 animate-bounce animation-delay-300">
<div class="h-1.5 w-1.5 rounded-full bg-gray-400"></div>
</div>
<div class="h-5 animate-bounce animation-delay-400">