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
// Credit to: https://stackoverflow.com/a/75537070/9336948 | |
if(!!window.React || | |
!!window.__REACT_DEVTOOLS_GLOBAL_HOOK__ || | |
!!document.querySelector('[data-reactroot], [data-reactid]')) | |
console.log('React.js'); | |
if(!!document.querySelector('script[id=__NEXT_DATA__]')) | |
console.log('Next.js'); | |
if(!!document.querySelector('[id=___gatsby]')) |
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
# Find files in directory | |
for f in *.m4a; do echo "file '$f'" >> mylist.txt; done | |
# Join found files using ffmpg | |
ffmpeg -f concat -i mylist.txt output.m4a |
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
<button | |
type="button" | |
class="btn btn-default btn-secondary" | |
popover="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." | |
popoverTitle="Popover on top" | |
placement="top" | |
> | |
Popover on top | |
</button> |
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 "regexp" | |
// Basic regular expressions for validating strings | |
const ( | |
Email string = "^(((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(([a-zA-Z]|[\\ |
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
Subject: Request for [Company Name] Account Deletion | |
Dear [Company Name] Team, | |
I am writing this email to request the deletion of my account as I have no further use for it. Kindly delete my account along with all my account information from your database. | |
Below are my account details: | |
Name: [Your Full Name] | |
Email: [Your Registered Email] |
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
@startuml | |
title Sequential Diagram of Electronic Payment | |
actor CustomerA | |
actor BankA | |
actor BankB | |
participant "Seller/Service Provider" as Seller | |
CustomerA -> Seller: INITIATE PAYMENT | |
activate Seller |
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 { ArgumentsHost, Catch, ExceptionFilter, HttpException, HttpStatus, Logger } from '@nestjs/common'; | |
@Catch() | |
export class HttpErrorFilter implements ExceptionFilter { | |
private readonly logger : Logger | |
constructor(){ | |
this.logger = new Logger | |
} | |
catch(exception: Error, host: ArgumentsHost): any { | |
const ctx = host.switchToHttp(); |
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
#Find the font | |
## Go to nerd fonts patched-fonts directory: https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts | |
# Go to user font directory | |
cd ~/.fonts | |
# Donwload a font file and save it. | |
curl -fLo "Droid Sans Mono for Powerline Nerd Font Complete.otf" https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/DroidSansMono/DroidSansMNerdFontMono-Regular.otf | |
# Rebuild the font cache | |
fc-cache -fv |
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
/** | |
* Sanitizes input data to mitigate potential security risks by removing or escaping | |
* special characters, HTML entities, Unicode characters, and null bytes. | |
* | |
* @param input The input data to be sanitized. | |
* @returns A sanitized version of the input data. | |
*/ | |
function sanitizeData(input: string): string { | |
/** | |
* Removes carriage return characters (\r). |
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
function generateRandomNumber(length: number): number { | |
return parseInt( | |
Math.ceil(Math.random() * Date.now()) | |
.toPrecision(length) | |
.toString() | |
.replace('.', ''), | |
10 | |
); | |
} |
NewerOlder