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
| /*Debounce Function*/ | |
| //================== | |
| /*Wait for the "quiet" moment.*/ | |
| function debounce(func, delay) { | |
| let timeoutId; | |
| return function(...args) { | |
| clearTimeout(timeoutId); // Reset the clock every time | |
| timeoutId = setTimeout(() => { |
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
| //after click of any buttons in the web application, I need to cancel any existing API request and must trigger the new API request associated with the Button. How do I do it in angular ? | |
| import { Subject, switchMap } from 'rxjs'; | |
| // Inside your component | |
| private clickTrigger = new Subject<void>(); | |
| // Set up the stream in ngOnInit or the constructor | |
| this.clickTrigger.pipe( | |
| switchMap(() => this.myService.getData()) |
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
| let m = new Map<string, number>([ | |
| ['address', 500], | |
| ['age', 25], | |
| ]); | |
| m.set('street', 400); | |
| console.log(m.get('address')) | |
| console.log(m) |
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
| nodemon --exec mocha -R min |
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
| https://gemini.google.com/share/3355cbddb91b |
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
| new Intl.DateTimeFormat('en-US', { | |
| timeZone: 'Asia/Calcutta', | |
| hour: "numeric", | |
| minute: "numeric", | |
| second: "numeric", | |
| }).format(new Date(new Date().toISOString())) |
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
| Product Form: | |
| ============ | |
| "use client" | |
| import { useActionState } from "react"; | |
| import { productAction } from "@/app/actions/product"; | |
| export default function ProductForm() { |
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
| from locust import User, task, between | |
| class MyUser(User): | |
| wait_time = between(2, 3) | |
| @task | |
| def my_task1(self): | |
| print('First Task 1') | |
| @task |
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
| // effects.ts declare as below, | |
| declare global { | |
| interface Window { | |
| dataLayer: any[]; | |
| } | |
| } | |
| ============== |
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
| interface Address { | |
| street: string; | |
| area: string; | |
| landmark: string; | |
| pincode: number; | |
| } | |
| type previewAddress = Pick<Address, 'pincode' | 'area'>; | |
| type previewAddress2 = Omit<Address, 'pincode'>; |
NewerOlder