Skip to content

Instantly share code, notes, and snippets.

View MiracleHu's full-sized avatar
🏠
Working from home

MiracleHu

🏠
Working from home
  • BayArea, CA, USA
View GitHub Profile
@MiracleHu
MiracleHu / axios.refresh_token.1.js
Created April 12, 2021 08:03 — forked from Godofbrowser/axios.refresh_token.1.js
Axios interceptor for refresh token when you have multiple parallel requests. Demo implementation: https://github.com/Godofbrowser/axios-refresh-multiple-request
// for multiple requests
let isRefreshing = false;
let failedQueue = [];
const processQueue = (error, token = null) => {
failedQueue.forEach(prom => {
if (error) {
prom.reject(error);
} else {
prom.resolve(token);
@MiracleHu
MiracleHu / gist:1c606b6147a2bd4696193816498f2697
Created October 15, 2020 02:01 — forked from JarenGlover/gist:d7ffab312ea756834218
Nginx - Reverse Proxy | Backend & Front End Example
upstream fuel {
# Defines a group of servers. Servers can listen on different ports.
server IP:PORT fail_timeout=0;
}
upstream frontend {
server IP:PORT fail_timeout=0;
}
@MiracleHu
MiracleHu / request.js
Created July 23, 2020 04:53 — forked from sheharyarn/request.js
Axios Request Wrapper for React (https://to.shyr.io/axios-requests)
/**
* Axios Request Wrapper
* ---------------------
*
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
*
*/
import axios from 'axios'

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@MiracleHu
MiracleHu / pipenv_cheat_sheet.md
Created March 30, 2020 21:26 — forked from bradtraversy/pipenv_cheat_sheet.md
Pipenv cheat sheet for common commands

Pipenv Cheat Sheet

Install pipenv

pip3 install pipenv

Activate

pipenv shell
@MiracleHu
MiracleHu / web-servers.md
Created February 18, 2020 07:46 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@MiracleHu
MiracleHu / file.js
Created October 15, 2015 17:54 — forked from gabrielpoca/file.js
/*
* Request: Javascript
*
* I would like to learn some basic concepts in JavaScript. Just as example, making a stopWatch and creating a racing game with few players which will have start and stop time for each player and choose one winner from them using the stopWatch object.
*/
// Design and Code a StopWatch
// Sample Use Case:
// var sw = new StopWatch();
// sw.start().stop().start().log();