These type definitions will help you work with react-intl-tel-input
in TypeScript while this library doesn't have official support for it.
Follow the development of baked-in types here: patw0929/react-intl-tel-input#346
Table of Contents
These type definitions will help you work with react-intl-tel-input
in TypeScript while this library doesn't have official support for it.
Follow the development of baked-in types here: patw0929/react-intl-tel-input#346
Table of Contents
import React, { useEffect, useRef } from 'react'; | |
/** | |
* Use setInterval with Hooks in a declarative way. | |
* | |
* @see https://stackoverflow.com/a/59274004/3723993 | |
* @see https://overreacted.io/making-setinterval-declarative-with-react-hooks/ | |
*/ | |
export function useInterval( | |
callback: React.EffectCallback, |
// works great on about:dino | |
// 1. save this file to your snippets. | |
// 2. load about:dino | |
// 3. evaluate the snippet | |
// 4. hit up arrow to trigger the game. | |
// 5. profit | |
(function() { | |
perfnow = performance.now; |
<img data-src="unicorn.jpg" loading="lazy" alt=".." class="lazyload"/> | |
<script> | |
// Select all images with the class "lazyload" | |
const images = document.querySelectorAll("img.lazyload"); | |
// Check if the browser supports the "loading" attribute | |
if ('loading' in HTMLImageElement.prototype) { | |
// If so, we'll update all <img src> to point to the data-src instead | |
images.forEach(img => { | |
img.src = img.dataset.src; |
Set-Alias less "C:\Program Files\Git\usr\bin\less.exe" | |
function f($text, $files="*.*") | |
{ | |
findstr /spin $text $files | less | |
} |
# list all listening ports | |
sudo lsof -i -P | grep -i "listen" | |
# list all processes using specific port - this will list all pid that using port 8080 | |
lsof -i :8080 | grep "LISTEN" | |
# tell which application is running on specfic pid (for example, 1237) | |
ps -ef | grep 12337 | |
# kill processes using port 8888 |
@Injectable({providedIn: 'root'}) | |
export class ExternalUrlService implements CanActivate { | |
canActivate({ data }: ActivatedRouteSnapshot): boolean { | |
window.open(data.externalUrl, '_blank'); | |
return false; | |
} | |
} |