Skip to content

Instantly share code, notes, and snippets.

Kevin He kevinxh

Block or report user

Report or block kevinxh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kevinxh
kevinxh / cache-requests.md
Last active Mar 29, 2019
Caching mechanism to avoid duplicate requests #pattern
View cache-requests.md

How to avoid sending duplicate requests?

It is common to see the client side sending duplicate fetch data requests to an API endpoint or desktop page.

To avoid sending duplicate requests, I recommend to implement a caching function that caches HTTP responses.

Example:

    // WARNING: this is sudo code, test before use!
    const promiseCache = {}
@kevinxh
kevinxh / docker-cheat-sheet.md
Last active Mar 29, 2019
Docker Cheat Sheet #docker
View docker-cheat-sheet.md
@kevinxh
kevinxh / git-branches-by-commit-date.sh
Last active Mar 29, 2019 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date. #git
View git-branches-by-commit-date.sh
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@kevinxh
kevinxh / API.md
Created May 22, 2016 — forked from iros/API.md
Documenting your REST API
View API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

You can’t perform that action at this time.