Skip to content

Instantly share code, notes, and snippets.

View bnguyensn's full-sized avatar
Hacking away...

Binh Nguyen bnguyensn

Hacking away...
View GitHub Profile
@bnguyensn
bnguyensn / dh-99-example-gha.yaml
Created March 30, 2021 15:08
DH-99 example GitHub action
# This job is right below "publish_results"
comment_on_jira:
name: "Comment on Jira"
if: github.event.action == 'opened'
needs: [linting, unit_test, end_to_end_test, deploy_pr_frontend, deploy_storybook, plan_staging, plan_prod]
runs-on: ubuntu-latest
steps:
- name: "Login to JIRA"
@bnguyensn
bnguyensn / git-alias.md
Created March 17, 2021 13:32
git aliases

Contains useful git aliases for .gitconfig

[alias]
	st = status
	
	aa = add .
	ca = "!git add . && git commit"
	c = commit
	cm = commit -m
@bnguyensn
bnguyensn / git-tag-npm-version.md
Last active February 27, 2021 11:25
git tag / npm version

git tag

This gist describes tagging in git

Annotated tags

Create a new annotated tag identified with "v1.0.0":

$ git tag -a v1.0.0
@bnguyensn
bnguyensn / youtube-to-mp3.md
Created August 2, 2020 22:11
Youtube videos -> .mp3

Convert Youtube videos to .mp3 with VLC

Here are the steps:

  1. Copy the Youtube video's link into VLC's "Open Network Stream" option (Media > Open Network Stream)
  2. Click Tools > Media Information
  3. Copy the "Location" text at the bottom and paste it into the browser
  4. Right-click the video in the browser and select "Save video as"
  5. Convert the downloaded video into .mp3 using FFmpeg: link
@bnguyensn
bnguyensn / deno.md
Last active June 6, 2020 10:11
Deno Land

Deno

Deno is the new and hip Node.js.

CLI

deno run <xxx>: execute a script

deno test <xxx>: execute a test script

@bnguyensn
bnguyensn / .gitconfig
Created May 11, 2020 08:28
Example .gitconfig
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
[user]
name = Binh Nguyen
[user]
email = [email protected]
[winUpdater]
recentlySeenVersion = 2.25.0.windows.1
@bnguyensn
bnguyensn / simple-git.md
Last active July 8, 2020 21:08
Simple git

1. START

1. Update master branch

Make sure all changes have been saved before this either per section 2.2 or 3.2 below.

git checkout master
git pull
@bnguyensn
bnguyensn / extensions.json
Last active April 22, 2020 18:36
Visual Studio Code Settings Sync Gist
[
{
"metadata": {
"id": "464f4ac7-af65-4aa9-9907-4ba7fa419085",
"publisherId": "bungcip.better-toml",
"publisherDisplayName": "bungcip"
},
"name": "better-toml",
"publisher": "bungcip",
"version": "0.3.2"
@bnguyensn
bnguyensn / useCallback-vs-useMemo.md
Last active January 1, 2022 17:58
useCallback vs useMemo

useCallback vs useMemo

At a glance

useCallback(fn, deps) is equivalent to useMemo(() => fn, deps).

useCallback useMemo
Function signature const someCallback = useCallback(() => { expensivelyCompute(a) }, [a]); const someValue = useMemo(() => expensivelyCompute(a), [a]);
What it does someCallback will only change if a changes. An example usage is when someCallback is passed down as a prop. The child receiving someCallback will only re-render when a changes. someValue will only be re-computed if a changes. Essentially the same someValue will never be calculated twice in a row (assuming expensivelyCompute() is a pure function, of course).
@bnguyensn
bnguyensn / go-notes.md
Last active February 14, 2022 20:59
Go notes

Go Notes

CLI

The most important Go CLIs:

Command Description
go build Compile packages and dependencies
go fmt Format package sources