Skip to content

Instantly share code, notes, and snippets.

@getify
getify / 1.md
Last active October 15, 2020 01:44
BetterPromise: a strawman experiment in subclassing Promise and "fixing" a bunch of its awkward/bad parts

Some things that are "better" with this BetterPromise implementation:

  • BetterPromise # then(..) accepts a BetterPromise (or Promise) instance passed directly, instead of requiring a function to return it, so that the promise is linked into the chain.

    var p = BetterPromise.resolve(42);
    
    var q = Promise.resolve(10);
    
    p.then(console.log).then(q).then(console.log);
@buritica
buritica / pr.md
Last active August 29, 2015 13:57
PR Template

What's this PR do?

Where should the reviewer start?

How should this be manually tested?

Any background context you want to provide?

What are the relevant tickets?

Screenshots (if appropriate)

Questions:

  • Does the knowledge base need an update?

Dependencies

@stutrek
stutrek / theelementsoftypographicstylesheet.css
Created July 4, 2012 19:04
Elements of Typographic Stylesheet
html.eotss_enabled body {
-webkit-font-feature-settings: 'clig', 'onum';
font-feature-settings: 'clig', 'onum';
}
/* This is slow. Best to put it in a timeout to give the UI time to update. */
html.eotss_enabled.eotss_slow body {
text-rendering: optimizeLegibility;
}
@remy
remy / gist:350433
Created March 31, 2010 14:58
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();