Skip to content

Instantly share code, notes, and snippets.

View rwhitmire's full-sized avatar
👢
New boot goofin'

Ryan Whitmire rwhitmire

👢
New boot goofin'
View GitHub Profile
@rwhitmire
rwhitmire / native.css
Created November 3, 2016 20:52
native fonts for major operating systems
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}
@rwhitmire
rwhitmire / makeCancelable.js
Created October 3, 2016 14:28
Cancelable Promises
// source: https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html
const makeCancelable = (promise) => {
let hasCanceled_ = false;
const wrappedPromise = new Promise((resolve, reject) => {
promise.then((val) =>
hasCanceled_ ? reject({isCanceled: true}) : resolve(val)
);
promise.catch((error) =>
@scttnlsn
scttnlsn / README.md
Created July 30, 2012 22:16
Pub/sub with MongoDB and Node.js

Pub/sub with MongoDB and Node.js

Setup:

$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})