Skip to content

Instantly share code, notes, and snippets.

View ThinhPhan's full-sized avatar
🎯
Focusing

Thinh Phan ThinhPhan

🎯
Focusing
View GitHub Profile
@ThinhPhan
ThinhPhan / .block
Created April 6, 2019 17:16 — forked from mbostock/.block
Gradient Along Stroke
license: gpl-3.0
@ThinhPhan
ThinhPhan / clean_code.md
Created April 5, 2019 17:45 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@ThinhPhan
ThinhPhan / docker-cleanup-resources.md
Last active April 10, 2019 16:50 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

Delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@ThinhPhan
ThinhPhan / tmux-cheatsheet.markdown
Created April 5, 2019 16:37 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ThinhPhan
ThinhPhan / bash-string-manipulation-cheatsheet.md
Last active May 19, 2019 03:40 — forked from magnetikonline/README.md
Bash string manipulation cheatsheet.

Bash string manipulation cheatsheet

Assignment
Assign value to variable if variable is not already set. Value will be returned.

Couple with : no-op if return value is to be discarded.
${variable="value"}
: ${variable="value"}
@ThinhPhan
ThinhPhan / postgres-cheatsheet.md
Created April 5, 2019 16:23 — 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)
@ThinhPhan
ThinhPhan / gitflow-breakdown.md
Created April 5, 2019 16:23 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

Resourceful Routing for CRUD Operations in Web Applications

Note: The RESTful routes also apply to RESTful APIs, however JSON is returned to the client vs. HTML

RESTful Routes:

HTTP Verb Path (endpoint) controller#action View to Render
or Redirect
Purpose
GET /posts posts#index index List all posts
GET /posts/:id posts#show show Show a single post