Skip to content

Instantly share code, notes, and snippets.

View mohamedaboelmagd's full-sized avatar
🎯
Focusing

Mohamed Aboelmagd mohamedaboelmagd

🎯
Focusing
View GitHub Profile
@mohamedaboelmagd
mohamedaboelmagd / strong-password-regex.md
Created December 28, 2022 13:15 — forked from arielweinberger/strong-password-regex.md
Strong password Regular Expression - NestJS Course
  • Passwords will contain at least 1 upper case letter
  • Passwords will contain at least 1 lower case letter
  • Passwords will contain at least 1 number or special character
  • There is no length validation (min, max) in this regex!

Regular expression for JavaScript:

/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/
### This gist is a part of the NestJS Zero to Hero course on Udemy.
### https://www.udemy.com/course/nestjs-zero-to-hero/?referralCode=F672C0C701844DC91F4D
To run PostgreSQL on Docker, run the following in your Terminal:
docker run --name postgres-nest -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres
@mohamedaboelmagd
mohamedaboelmagd / dabblet.css
Created March 30, 2022 10:42 — forked from diggs00/dabblet.css
Vertical Line using :after
/**
* Vertical Line using :after
*/
.item {
float:left;
display:inline;
padding-right:10px;
}
@Component({
template: `
<form>
...
<button (click)="submit()" *ngIf="isDirty$ | async">Save</button>
</form>
`
})
export class SettingsComponent {
settings = new FormGroup({...});
export function dirtyCheck<U>(source: Observable<U>) {
return function<T>(valueChanges: Observable<T>): Observable<boolean> {
const isDirty$ = combineLatest(
source,
valueChanges,
).pipe(
debounceTime(300),
map(([a, b]) => isEqual(a, b) === false),
startWith(false),
export function dirtyCheck<U>(source: Observable<U>) {
let subscription: Subscription;
let isDirty = false;
return function <T>(valueChanges: Observable<T>): Observable<boolean> {
const isDirty$ = combineLatest(
source,
valueChanges,
).pipe(
debounceTime(300),