Typescript note - Generics

πŸ€Έβ€β™€οΈ Make Type generic with Generic

Created a function which reaturns the last number from the array.

1
2
3
4
5
6
const getLast = (arr: number[]) => {
return arr[arr.length - 1];
};

const lastNumber = getLast([1, 2, 3]);
console.log(lastNumber); // 3

Read More

Change the destination of Mac screenshots

1. Create a directory

e.g. Create Screenshots directory on Desktop

1
2
cd ~/Desktop
mkdir Screenshots

2. Set the directory as the destination

1
defaults write com.apple.screencapture location ~/Desktop/Screenshots/;killall SystemUIServer

Read More

Currying

What is currying?

A. β€œReturning a function that takes multiple arguments” into a β€œchain of functions that takes one argument”

Read More