Skip to content

Instantly share code, notes, and snippets.

View narenranjit's full-sized avatar

Narendran Ranjit narenranjit

  • Frontpage.to
  • San Francisco, CA
View GitHub Profile
@fwielstra
fwielstra / api.js
Created June 14, 2011 14:46
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
@staltz
staltz / introrx.md
Last active July 4, 2024 10:11
The introduction to Reactive Programming you've been missing
@developit
developit / _Dead Simple Fetch Caching.md
Created August 28, 2016 15:36
Dead simple fetch caching

Dead Simple Fetch Caching

Wrap fetch() in a memoize.

Not only does this cache repeated requests for the same resource, it also de-dupes concurrent requests!

Notes:

  • Caching the raw response object doesn't work, since the response body is a stream and can thus only be read once
  • Instead, cache your already read body (optionally still including the original request, just read the body prior)