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),
@mohamedaboelmagd
mohamedaboelmagd / vmdxToIso.txt
Created September 10, 2020 08:51
convert vmdk to iso
This was easy because I’d installed QEMU earlier on my system via Homebrew, so it was easy to convert the VMDK (the VMware disk image) to a RAW image image:
> qemu-img convert -f vmdk puredarwinxmas.vmdk pd.raw
This captures the contents of the VMware image into a raw image in some (unbeknownst to me) format. You can then write this to an ISO file:
> dd if=pd.raw of=pd.iso
That’s it. You can then mount this ISO, put it up for download, or whatever. This shouldn’t be limited to PureDarwin, and should work for most VMware disk images as long as it is stored as a VMDK file.
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:muport:QmeqQETUT587avA6JXiBTiTpgif8PzcLwsoVDyqDr2krqx ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:muport:QmYnGmzou2bvhXAr4TpdXdW9uJe5K2671x6jHE7p4cwZsp ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
@mohamedaboelmagd
mohamedaboelmagd / custom last months.ts
Created May 30, 2019 07:53
analytics on timestamp
cleanPerMonth(
data: {
counter: number;
month: number;
year: number;
}[],
numberOfMonths: number
) {
const result = [];
const everyMonth = [];