Skip to content

Instantly share code, notes, and snippets.

View temitopeakin1's full-sized avatar
πŸ’­
Nerd

Temitope Akinmegha temitopeakin1

πŸ’­
Nerd
View GitHub Profile
<!-- if it is a failed loan -->
<div *ngIf="up || lp; else nolp">
<!-- sidenav -->
<div class="main__content loandetails">
<div *ngIf="!serverError && canViewLoan">
<!-- for a pending loan -->
<app-breadcrumb [navList]="navList"></app-breadcrumb>
<div class="main__content-title d-flex justify-content-between">
<div class="page-title col-10 col-sm-5 col-md-5">
<h1 class="title">{{ pageTitle }}</h1>
import { PaginationModel } from "src/app/model/pagination.model";
import { Component, DestroyRef, OnInit, inject } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { Constant, Permission_Constant } from "src/app/utils/constant";
import { AuthService } from "src/app/services/auth/auth.service";
import { LoansService } from "src/app/services/loans/loans.service";
import { Location } from "@angular/common";
import {
catchError,
debounceTime,
@temitopeakin1
temitopeakin1 / gist:000d95953aa916a02f5b250049ee56ad
Created October 16, 2024 05:03
how to use optimized typeScript -- Typescript solutions
// note conditional types in typescript creates more typesafe solutions
type FormatTableData = string | number | Date;
function formatValue(value: FormatTableData, type: 'string' | 'number' | 'date'): string {
switch(type) {
case 'string':
return (value as string).toUpperCase();
case 'number':
return `${(value as number).toFixed(2)}`;
case 'date':

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? β˜†β˜†

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

@temitopeakin1
temitopeakin1 / gist:bcd7b094580f0647dffedd050b1b0e85
Last active June 14, 2023 19:15
AES encryption on angular
Steps:
a. create a service for the encryption
give it any name for example (encrypt-decrypt.ts)
b. import the service to where you want the encryption to be
import { EncryptDecryptService } from "../shared/services/data-service/encrypt-decrypt";
c. include it as a private object in the constructor function,
e.g private _EncryptDecryptService: EncryptDecryptService
d. write the logic for the AESencrytion (CryptoJs)
i. for the parameters you want to encrypt(username & Password)
@temitopeakin1
temitopeakin1 / Crypto-js angular
Last active June 13, 2023 15:36
Encryption and decryption of data using AES encryption(Cryptojs)
import * as CryptoJS from 'crypto-js';
import { environment } from "src/environments/environment";
// keys are hidden in the environment.ts or environment.prod.ts
const secretKey = CryptoJS.enc.Utf8.parse(environment.secretKey).toString();
const iv = CryptoJS.enc.Utf8.parse(environment.iv);
// encryption
const encryptedModel = CryptoJS.AES.encrypt(
JSON.stringify(model), // to convert object to strings
class Node {
public int value;
public Node left, right;
public Node(int value, Node left, Node right) {
this.value = value;
this.left = left;
this.right = right;
}
}
@temitopeakin1
temitopeakin1 / ChangeUsername.md
Created May 21, 2022 21:20 — forked from ifindev/ChangeUsername.md
Random React Test

This application should allow the user to update their username by inputting a custom value and clicking the button.

The Username component is finished and should not be changed, but the App component is missing parts. Finish the App component so that the Username component displays the inputted text when the button is clicked.

The App component should use the React.useRef Hook to pass the input to the Username component for the input element and for the Username component.

For example, if the user inputs a new username of "John Doe" and clicks the button, the div element with id root should look like this:

<div><button>Change Username</button><input type="text"><h1>John Doe</h1></div>