Skip to content

Instantly share code, notes, and snippets.

View faical23's full-sized avatar
🎯
okey

Faical Bahsis faical23

🎯
okey
View GitHub Profile
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active May 2, 2024 19:03
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@muratpurc
muratpurc / gist:2314727
Created April 5, 2012 22:36
PHP: Regex to validate different phone number formats
<?php
/**
* Regular expression to validate different types of phone numbers
*/
// simple pattern
$pattern = '/^[0-9\-\(\)\/\+\s]*$/';
// example phone numbers
$phoneNumbers = '