Skip to content

Instantly share code, notes, and snippets.


Charles Mutagorama cmutagorama

View GitHub Profile
View steps-to-rebase.txt
1. git checkout feature
2. git rebase master
3. Fix conflicts if any
4. git rebase -continue
5. git push origin feature -f
cmutagorama / sizing-unsplash-img.js
Created Dec 10, 2021
setting size of unsplash image
View sizing-unsplash-img.js
const imageId = 'Mv9hjnEUHR4';
const width = 600;
const height = 800;
const url = `${imageId}/${width}x${height}`;
cmutagorama / optional-chaining-nullish-coalescing-operators.ts
Last active Jan 31, 2021
Typescript 3.7 introduced 2 amazing operators: Optional chaining and Nullish coalescing here's how to take advantage of them
View optional-chaining-nullish-coalescing-operators.ts
// Before
const val = otherVal !== null && otherVal !== undefined && otherVal.prop !== null && otherVal.prop !== undefined &&;
// With optional chaining
const val = otherVal?.prop?.name;
const name = company.employees?.[0]?.name;
// let's say you want to return a undefined value, that's when nullish coalescring operator comes in handy.
const val = otherVal?.prop?.name ?? 'Anonymous';
const name = company.employees?.[0]?.name: 'User';
cmutagorama / export-steps.txt
Created Jan 31, 2021
Steps of backing up/exporting database in pgAdmin
View export-steps.txt
Right-click on your table and pick option Backup..
On File Options, set Filepath/Filename and pick PLAIN for Format
Ignore Dump Options #1 tab
In Dump Options #2 tab, check USE INSERT COMMANDS
In Dump Options #2 tab, check Use Column Inserts if you want column names in your inserts.
Hit Backup button