Skip to content

Instantly share code, notes, and snippets.

View juandopazo's full-sized avatar

Juan Dopazo juandopazo

View GitHub Profile
@Rich-Harris
Rich-Harris / service-workers.md
Last active April 21, 2024 16:24
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

test 123
@juandopazo
juandopazo / gist:5405383
Last active December 16, 2015 08:19
Storage module design and API for review

Storage

Motivation

There are 3 major types of storage is browsers up to date:

  • IndexedDB. The future.
  • localStorage. Limited in size and can be observed through the storage event.
  • WebSQL. Dropped by the W3C but it's still very present in the wild, with notable platforms like iOS and PhoneGap.
@juandopazo
juandopazo / gist:3193926
Created July 28, 2012 16:34
Server Y.Router
YUI.add('router', function (Y) {
/**
Provides URL-based routing for Node
@module app
@submodule router
@since 3.4.0
**/
var QS = Y.QueryString,
@juandopazo
juandopazo / gist:2901426
Last active September 10, 2018 07:59
Privates and WeakMaps
// Based on a gist by @rwaldron
// https://gist.github.com/2897761
function privatize() {
var map = new WeakMap();
return function private(obj) {
var data = map.get(obj);
if (!data) {
map.set(obj, data = {});
}
@rwaldron
rwaldron / device.js
Created May 10, 2012 16:21
Fat Arrows and Classes-as-Prototype-sugar make a beautiful future for JavaScript
var stream = require("fake-stream-lib"),
Emitter = require("events").EventEmitter,
util = require("util");
// Today...
function Device( opts ) {
this.value = null;
@lsmith
lsmith / gist:2375130
Created April 13, 2012 08:37
Ye Olde brainstorm about IO API

Data normalization API proposal

Data API normalization/centralization in three layers

  1. transport layer

  2. transaction layer

  3. encapsulated configuration layer (aka Resource/DataSource)

  4. Transport layer

@davglass
davglass / unix.txt
Created December 7, 2011 17:40
YUIDoc with 3.5.0 install instructions
Unix Install Instructions (until it's available via npm)
git clone git://github.com/yui/yui3.git
git clone git://github.com/davglass/yuidocjs.git
cd yui3/src/yui
make npm
cd ../../../yuidocjs
git checkout -t origin/3.5.0
@derek
derek / gist:1389403
Created November 23, 2011 18:09
YUI 3 Button Proposal

YUI Button

Goal

To introduce a new Button component for YUI 3 that addresses the following user stories

  • "I want buttons on my site to look consistent & attractive."
  • "I want to be able to programmatically control buttons in my application."
  • "I want to my buttons to be intelligent and interact with one another in groups."
  • "I want my application to be able to dynamically generate buttons."
@BrendanEich
BrendanEich / minimalist-classes.js
Created November 1, 2011 22:48 — forked from jashkenas/minimalist-classes.js
less minimalism, richer leather
// A response to jashkenas's fine proposal for minimalist JavaScript classes.
// Harmony always stipulated classes as sugar, so indeed we are keeping current
// JavaScript prototype semantics, and classes would only add a syntactic form
// that can desugar to ES5. This is mostly the same assumption that Jeremy
// chose, but I've stipulated ES5 and used a few accepted ES.next extensions.
// Where I part company is on reusing the object literal. It is not the syntax
// most classy programmers expect, coming from other languages. It has annoying
// and alien overhead, namely colons and commas. For JS community members who