Skip to content

Instantly share code, notes, and snippets.

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

Marcos Cáceres marcoscaceres

🏠
Working from home
View GitHub Profile
@marcoscaceres
marcoscaceres / index.html
Created August 25, 2012 21:02
A bit of simple code to enable the full ES Internationalization API in Chrome 21+. Does not work in Chrome Canary.
<h1>Examples</h1>
@marcoscaceres
marcoscaceres / testingplan.md
Created November 10, 2012 18:27
Testing plan for W3C

W3C QA Manager – Preliminary Project Plan

This document outlines a preliminary project plan for the W3C QA Manager position. It also identifies the stakeholders, their needs, and a set of tasks for the QA Manager to kick-start the project. I’ve assumed that the project will run for approximately 2 years. Some aspects may require additional funding from the W3C or its membership.

This is a draft/personal proposal for review by the general public. It has no official standing and is not endorsed by the W3C.

Responsibilities of the QA Manager

Having spoken to various stakeholders and W3C members, I’d like to propose that the QA manager have the following responsibilities (these cover the responsibilities listed on the W3C's description of the position, but go into a bit more detail on each):

  • Gather understanding of the requirements from the various industry sectors involved at the W3C. Particularl
@marcoscaceres
marcoscaceres / gist:4161268
Created November 28, 2012 13:25
Bugs to file against srcset

Bug 1 - Art Direction not supported

Although img@srcset supports the resolution matching use case in a limited way, it does not fully support the art direction use case. To support the the art direction use case, there needs to be some mechanism in place to force the browser to display a given image when condition is met. This is akin to the use case for CSS's !important rule.

Bug 2 - No way to determine which source is being displayed

The img@srcset spec lacks a script-based means to determine what resource the image element is displaying (if any). The use case for this is for testing and generally for a developer to know what is going on.

Bug 3 - lacks way to support different image types

The img@srcset spec currently lacks a way for alternative image formats to be supported. This means that content negotiation must be done on either on the server, which is knows to be both problematic and does not scale well. Or it must be done on the client using a whole bunch of nasty hacks (e.g., downloading a

@marcoscaceres
marcoscaceres / gist:4272845
Created December 12, 2012 23:57
Rewrite of Chris' implementation of Web MIDI API.
(function(exports, global, perf) {
'use strict';
var jazzInstances = [];
if ('getMIDIAccess' in exports) {
return; // namespace is taken already, bail!
}
exports.getMIDIAccess = getMIDIAccess;
function getMIDIAccess(successCallback, errorCallback) {
if (typeof successCallback !== 'function') {
@marcoscaceres
marcoscaceres / ChestnutRisotto.md
Last active June 2, 2017 11:52
Chestnut Risotto

Chestnut Risotto - Level 1

Cooking Recommendation

Abstract

This recipe produces a risotto that has been described as "yummy". Because of its heavy dependency on chestnuts, it is seasonable for December. Serves 4.

Status of this Document

This section describes the status of this recipe at the time of its publication. Other recipes may supersede this recipe, specially if it doesn't taste as good as it could.

Conformance

@marcoscaceres
marcoscaceres / MIDI API.md
Last active December 10, 2015 04:58
Re-imagining the Web MIDI API security model as well as some other parts... this is just a strawman.

Thinking about the security model.

Lets say I'm a making game... I want to just use the system's standard output.

This case handles the user having a standard output port, plus the user has plugged in some other output device.

(function() {
  var midi = navigator.midi, 
      out;
@marcoscaceres
marcoscaceres / exportInterfaceObject.js
Last active December 10, 2015 07:38
Exports a function to the global scope in a way that conforms to WebIDL.
/**
* Exports a function to the global scope in a way that conforms to Web IDL.
*
* These objects are indistiguishable from host objects. That is, you can create
* objects like the ones that are exposed by the browser, like window.Event,
* window.Node, etc.
*
* Copyright (c) 2012 Marcos Caceres / François REMY
* Licensed under the MIT license.
*
function Resistors() {}
function Resistor(resistance) {
resistance = +resistance;
if(isNaN(resistance)){
throw TypeError()
}
var props = {
"resistance": {
get: function () {
@marcoscaceres
marcoscaceres / gist:5055717
Last active December 14, 2015 08:09
Firefox OS i18n Model

Internationalization model of Firefox OS

This document lists a set of localization scenarios and describes how Firefox OS handles these different use cases. The document makes some recommendations about how particular use cases could be better addressed.

To simplify the discussion, this document assumes the runtime is running in locale "en-US".

CASE 1 - No localisation information.

Use case: The author does not wish to explicitly localize any content.

Rethinking the Messaging API

The current abstractions are kinda messaged up in the Messaging (and Contacts) API. For one, you need to deal with objects directly sometimes, other times you need to deal with them through events, or through a manager etc. This makes the whole API very difficult and confusing to use - it's also not very "JavaScripty".

I propose that the API be changed so it works like this:

Sending messages and dealing with events

//Sending SMS - returns a Future.