Skip to content

Instantly share code, notes, and snippets.

{
"devtools.debugger.remote-enabled": true,
"latecustomization.manifestURL": "https://marketplace-dev.allizom.org/api/v2/late-customization/?carrier=telenor&region=ca",
"latecustomization.operatorInfo": { "operator": "acme", "region": "ca" }
}

Here vs. There: Hoarding the Web

The Problem

Web phone, web-based, built on web tech, the cloud - all tweak a little niggling truth we all know: The web doesnt work offline. When we have no connection it may as well not exist.

And despite proliferation of wifi and 3/4g, a connected mobile device is limited at least some of the time. Perhaps most of the time.

@sfoster
sfoster / sector1.md
Last active December 14, 2015 11:49
Can we shape the future and get real planets for all the Elite system names?

Proposed Elite System Names on uwingu.com

Remember your travels as Commander Jameson? How awesome would it be to look over a real astronomical chart and pick out Diso, Lave, Leesti and other favourites? Uwingu is building a database of proposed names for exoplanets. If you can propose and up-vote Elite names, it just might actually happen.

To propose a name, first check it isn't already registered (if it is, vote for it). Then go to the nominate page and fill in the details. Payment is $5 to uwingu via Paypal. Include Elite in your description (I used "Diso was one of the Sector 1 planets in the classic space trading game Elite. It would be wonderful to immortalize this piece of gaming history, so that future Commander Jamesons can chart a path through familiar territory.")

@sfoster
sfoster / gist:4608516
Created January 23, 2013 15:53
Array intersection: an array of values which occur in each of the passed arrays. Does the right thing with empty arrays.
var palette1 = ("white,green,brown,blue,orange").split(','),
palette2 = ("cyan,orange,black,white").split(','),
palette3 = ("black,white,grey").split(',');
// given one or more arrays of values,
// return an array with only those values present in each
function intersection() {
var lists = Array.prototype.slice.call(arguments);
return lists.reduce(function(aCommon, aValues){
var overlap = aValues.filter(function(val){
@sfoster
sfoster / gist:4275965
Created December 13, 2012 11:58
Exploring layout of a sequence of async steps to setup, run and teardown a series of unit tests, using task.js. You'll need a recent Firefox for the generator (yield) support.
<html>
<head><title>Async unit testing with task.js (exploration)</title></head>
<script type="application/javascript" src="https://raw.github.com/mozilla/task.js/master/lib/task.js"></script>
<script type="application/javascript;version=1.8">
function go() {
var { spawn, join, TaskResult, Deferred } = task;
var mydata = { foo: "bar" };
// shared functions for test setup
@sfoster
sfoster / map.js
Created March 23, 2012 23:22
a map function for arrays *or* objects
function map(obj, fn, thisArg){
// suggest you polyfill if you need Javascript < 1.6
var result = {};
if(obj instanceof Array){
result = obj.map(fn, thisArg || null);
} else {
Object.keys(obj).forEach(function(key){
result[key] = fn.call(thisArg || null, obj[key], key, obj);
});
}
@sfoster
sfoster / gist:1404965
Created November 29, 2011 14:24
yui-inspired grid css
/**
* grid essentials
*/
.row {
letter-spacing: -0.31em; /* webkit: collapse white-space between units */
*letter-spacing: normal; /* reset IE < 8 */
word-spacing: -0.43em; /* IE < 8 && gecko: collapse white-space between units */
}
.col {
@sfoster
sfoster / gist:1338146
Created November 3, 2011 22:44
Steppe rgba buffer data micro-optimization
diff --git a/js/Steppe/Renderer.js b/js/Steppe/Renderer.js
index 77bf78b..22f16bc 100644
--- a/js/Steppe/Renderer.js
+++ b/js/Steppe/Renderer.js
@@ -361,20 +361,15 @@ var Steppe = (function(Steppe) {
(top * (framebufferImageData.width << 2)) +
(ray << 2);
-
- var bufferR = (color >> 24) & 0xff,
@sfoster
sfoster / domQuery.js
Created October 17, 2011 22:19
Simplfied dojo.query wrapper to provide streamlined support for the :eq() pseudo-selector
function domQuery(selector, scopeNode){
// summary:
// Wrap dojo.query to provide support for the :eq() pseudo-selector
// See: http://api.jquery.com/eq-selector/
var reEqPseudo = /:eq\((\d+)\)/,
results = new dojo.NodeList;
scopeNode = scopeNode || dojo.doc.documentElement;
@sfoster
sfoster / gist:1267150
Created October 6, 2011 11:07
Identify unlabelled inputs on the page (wcag2) (uses dojo)
(function(){
// usage:
// dojo.create("script", { src: 'https://raw.github.com/gist/1267150/b786273d696a119bba26c4590b1608aa9a21755f/gistfile1.txt?'+(new Date).getTime(), type: 'text/javascript' }, dojo.query("head", document.documentElement).shift())
var labelMap = {};
dojo.query("label[for]").forEach(function(lbl) {
labelMap[lbl.htmlFor]=lbl;
});
console.log("labelMap: ", labelMap);
var selector = [
"input[type=text]",