Skip to content

Instantly share code, notes, and snippets.

View sangdth's full-sized avatar
📖
Docendo discimus

Sang Dang sangdth

📖
Docendo discimus
View GitHub Profile
@sangdth
sangdth / ssh-add.md
Created June 20, 2022 02:53
ssh-add

Still don't know why I have to do this once in a while

Error message:

# Access denied.
# fatal: Could not read from remote repository.

# Please make sure you have the correct access rights
# and the repository exists.
@sangdth
sangdth / fnm2.md
Last active September 28, 2022 21:09
Auto install current global npm packages after fnm install

The fnm still does not support -reinstall-packages-from like nvm, so I wrote this script for me while waiting.

#!/bin/sh

# Remember to alias fnm='fnm2' for convinient

# TODO: How to make the (which fmn) work here instead of hard coded path?
/opt/homebrew/bin/fnm $*
@sangdth
sangdth / ErrorBoundary.tsx
Created February 25, 2023 08:59
Implementation of an error boundary in React functional component
import { useState, useEffect } from 'react';
function ErrorBoundary({ fallback, children }) {
const [error, setError] = useState(null);
useEffect(() => {
if (error) {
// log the error or send it to a server
console.error(error);
}
@sangdth
sangdth / redis-commands.md
Last active December 14, 2023 12:56
My list of most used Redis commands