Skip to content

Instantly share code, notes, and snippets.

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

Devarsh Shah devarsh

🏠
Working from home
  • Ahmedabad
View GitHub Profile
@devarsh
devarsh / promiseQueue.js
Last active March 23, 2020 20:22
Promise Queue for handling key based fetch, with timeout and cache to minimise network request
/*PromiseQueue
It provides the following functionality
1. Put promises in queue and maintain count of currently executing promises
2. Promise expiration if the timeout has expired
3. Promise caching
Each Promise is refered by a unique key
- if promise is already running against that same value, reference of the currently running promise will be provided.
- if promise is already running the a new value is provided, old promise will be cancel because its result would be
stale now, and new promise will be spwaned and the reference would be returned.
- if promise has already finised executing but if its available in cache, promise result will be returned wrapped in a promise.
package main
import (
"fmt"
"io/ioutil"
"net/http"
"sync"
)
func main() {
@devarsh
devarsh / ReactRouterLink.js
Last active May 8, 2017 15:55
Using React Router v4 Link Component With Any Framework, using Function as Child Components.

#RxJS 5 Operators By Example A (soon to be) complete list of RxJS 5 operators with easy to understand explanations and runnable examples.

(I will be adding one operator per day until all are included.)

Chinese Version by: @DrakeLeung

Table of Contents