View Queue.js
This file contains 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
/** | |
* A queue can remove only the most recently added value, what if we need to remove old value. here comes another | |
* data structure QUEUE. | |
* queue is work on FIRST IN FIRST OUT | |
* | |
* queue is work on LAST IN FIRST OUT principle. | |
* queue is just like array with only capabilities of push and pop (method). | |
* [6] | |
* [5] | |
* [4] |
View Stack.js
This file contains 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
/** | |
* A stack is useful when we want to add data in sequential order and remove data. Based on its definition, | |
* a stack can remove only the most recently added data. | |
* | |
* stack is work on LAST IN FIRST OUT principle. | |
* stack is just like array with only capabilities of push and pop (method). | |
* [6] ----> which is last element of stack | |
* [5] | |
* [4] | |
* [3] |
View singleLinkedList.js
This file contains 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
/** | |
* linked list is a linear data structure similar to an array. However, unlike arrays, | |
* elements are not stored in a particular memory location or index. Rather each element is a separate | |
* object that contains a pointer or a link to the next object in that list. | |
* for ex: head--> [D, reference to next] [D, reference to next] [D, null] --> tail | |
* D belongs to data. | |
* The head is a reference to the first node in the linked list. | |
* The last node on the list points to null. If a list is empty, the head is a null reference | |
*/ |
View remove.empty.js
This file contains 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
/** | |
* Recurcively remove empty value, empty object. | |
* you can add more checks on line 12 as per your requirments | |
**/ | |
function removeEmpty(data) { | |
return Object.keys(data).reduce((accumulator, key) => { | |
const isObject = typeof data[key] === 'object'; | |
const isDateTime = key === 'from_date_time' || key === 'to_date_time'; | |
const value = isObject ? this.removeEmpty(data[key]) : data[key]; |
View app-routing.module.ts
This file contains 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
import { NgModule } from '@angular/core'; | |
import { RouterModule, Routes } from '@angular/router'; | |
const routes: Routes = [{ | |
path: 'home', | |
component: HomeComponent, | |
children: [ | |
{ path: '', redirectTo: 'email', pathMatch: 'full', data: { title: 'Email' } }, | |
{ path: 'email', component: EmailListComponent }, |
View object-to-formData.ts
This file contains 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
public objectToFormData(request) { | |
// create form data | |
const newPostRequest: FormData = new FormData(); | |
Object.keys(request).forEach(x => { | |
newPostRequest.append(x, request[x]); | |
}); | |
return newPostRequest; |
View timer-component.html
This file contains 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
<h2>{{remainingSeconds$ | async}}<> |
View node-basic-scrape.js
This file contains 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 scrape = require('website-scraper'); | |
const websiteUrl = 'Website url you want to scrap'; | |
scrape({ | |
urls: [websiteUrl], | |
urlFilter: function (url) { | |
return url.indexOf(websiteUrl) === 0; | |
}, | |
recursive: true, | |
maxDepth: 50, |