This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const countriesFlag = [ | |
{ | |
emoji: '🇦🇫', | |
code: 'AF', | |
}, | |
{ | |
emoji: '🇦🇽', | |
code: 'AX', | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Example\Providers; | |
use SmartPay\Framework\Support\ServiceProvider; | |
class ExampleServiceProvider extends ServiceProvider | |
{ | |
public function register() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$shouldExecute = RateLimiter::attempt( | |
'browser_tracker' . geoip()->getClientIP(), | |
1, // max attempts | |
function () { | |
// your code here | |
}, | |
2 // seconds | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Solution { | |
/** | |
* @param Integer[] $numbers | |
* @return Integer[] | |
*/ | |
function productExceptSelf($numbers) { | |
$answer = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nanoid = (length = 10) => { | |
let id = ''; | |
while (id.length < length) { | |
id += 'ABCDEFGHIJKLMNPQRSTUVWXYZ123456789'.charAt(Math.floor(Math.random() * 34)); | |
} | |
return id; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
/** | |
* Convert json object to FormData | |
* | |
* @param data | |
* @param options | |
* @returns FormData | |
*/ | |
const jsonObjectToFormaData = (data, formData = new FormData()) => { | |
convertRecursively(data, formData); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const uuid = function () { | |
var d = new Date().getTime(); | |
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { | |
var r = (d + Math.random() * 16) % 16 | 0; | |
d = Math.floor(d / 16); | |
return (c == 'x' ? r : (r & 0x7) | 0x8).toString(16); | |
}); | |
return uuid; | |
}; |