Skip to content

Instantly share code, notes, and snippets.

View cmutagorama's full-sized avatar
🎯
Focusing

Charles Mutagorama cmutagorama

🎯
Focusing
View GitHub Profile
@cmutagorama
cmutagorama / steps-to-rebase.txt
Last active January 22, 2022 13:43
git rebase steps
1. git checkout feature
2. git rebase master
3. Fix conflicts if any
4. git rebase -continue
5. git push origin feature -f
@cmutagorama
cmutagorama / sizing-unsplash-img.js
Created December 10, 2021 18:30
setting size of unsplash image
const imageId = 'Mv9hjnEUHR4';
const width = 600;
const height = 800;
const url = `https://source.unsplash.com/${imageId}/${width}x${height}`;
@cmutagorama
cmutagorama / optional-chaining-nullish-coalescing-operators.ts
Last active January 31, 2021 12:16
Typescript 3.7 introduced 2 amazing operators: Optional chaining and Nullish coalescing here's how to take advantage of them
// Before
const val = otherVal !== null && otherVal !== undefined && otherVal.prop !== null && otherVal.prop !== undefined && otherVal.prop.name;
// 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
cmutagorama / export-steps.txt
Created January 31, 2021 11:57
Steps of backing up/exporting database in pgAdmin
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