Skip to content

Instantly share code, notes, and snippets.

View OlaoluwaM's full-sized avatar
🧠
Always learning

Olaoluwa Mustapha OlaoluwaM

🧠
Always learning
View GitHub Profile
@OlaoluwaM
OlaoluwaM / node-typescript-esm.md
Created December 5, 2023 10:08 — forked from khalidx/node-typescript-esm.md
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@OlaoluwaM
OlaoluwaM / iterm2.md
Created January 9, 2023 19:22 — forked from squarism/iterm2.md
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
echo-server-epoll
echo-server-poll
talk
talk.dSYM
@OlaoluwaM
OlaoluwaM / postgres-cheatsheet.md
Created August 17, 2022 22:33 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@OlaoluwaM
OlaoluwaM / BDLinux.md
Created July 6, 2022 15:10 — forked from ObserverOfTime/BDLinux.md
Install BetterDiscord on Linux

Install BetterDiscord on Linux

This Gist contains simple instructions on how to install, update, and uninstall BetterDiscord on Linux.

For more thorough documentation, take a look at betterdiscordctl's README.

Do NOT submit issues here as I don't check the comments. You should submit them here instead.

@OlaoluwaM
OlaoluwaM / namedParams.test.ts
Last active June 25, 2022 13:04
A way of invoking your functions with a named parameter technique as opposed to positional parameters. Really useful in functional programming where there is a great emphasis on the manipulation of function shapes
// test #1
const exampleFn = (a: number, b:string, c: boolean) => [a, b, c]
const namedParamExampleFn = toNamedParams(exampleFn)
console.log(namedParamExampleFn({c: true, a: 1}))
// test #2
function testFn(a: number, b: string) {
return a + b
@OlaoluwaM
OlaoluwaM / memoize.js
Created June 14, 2022 08:42 — forked from jherax/memoize.js
High-order function that memoizes a function
/**
* @summary
* High-order function that memoizes a function, by creating a scope
* to store the result of each function call, returning the cached
* result when the same inputs is given.
*
* @description
* Memoization is an optimization technique used primarily to speed up
* functions by storing the results of expensive function calls, and returning
* the cached result when the same inputs occur again.
@OlaoluwaM
OlaoluwaM / README-Fancy.md
Created May 29, 2022 05:57 — forked from ramantehlan/README-Fancy.md
README template I use for most of my projects.

Introduction

  • Add your project logo.
  • Write a short introduction to the project.
  • If you are using badges, add them here.

📒 Index

@OlaoluwaM
OlaoluwaM / The Rules.md
Created April 20, 2022 07:05 — forked from sebmarkbage/The Rules.md
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.