Skip to content

Instantly share code, notes, and snippets.

View tofumatt's full-sized avatar

Matthew Riley MacPherson tofumatt

View GitHub Profile
@tofumatt
tofumatt / Face Value writeup.markdown
Created October 25, 2012 18:05
Face Value writeup

Face Value

by tofumatt, Mozilla's Vespa Expert

Face Value is a currency conversion app that does things differently: instead of converting arbitrary amounts it shows you the actual denominations in the country you're visiting. It lets you think in your home currency even with a foreign currency in your pocket.

Face Value was built by Matthew Riley MacPherson and sarah ✈ semark. Both are remote-working, frequent travellers.

Why We Built Face Value

define('tpl!templates/player.ejs', function() {return function(obj) { var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(''); if (episode.id) { ; __p.push(' '); if (blobURL) { ; __p.push(' '); if (!softwareDecode) { ; __p.push(' <audio id="audio" src="', blobURL ,'" episode="', episode.get('id') ,'" autoload></audio> <div id="time-info"> <span id="time-elapsed"></span> <span id="time-remaining"></span> <progress id="audio-progress"></progress> </div> '); } ; __p.push(' <a id="play-pause" href="#play-pause" data-paused="1" class="paused"><span class="hide">', l('Play/Pause') ,'</span></a> '); } ; __p.push(' <h2 class="podcast-title hide">', episode.podcast().get('name') ,'</h2> <h3 class="episode-title">', episode.get('title') ,'</h3> '); if (!!episode.get('description')) { ; __p.push(' <p class="description">', episode.get('description') ,'</p> '); } ; __p.push(''); } else { ; __p.push(' <h2 class="title">', l('Nothing play
define('tpl!templates/player.ejs', function() {return function(obj) { var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(''); if (episode.id) { ; __p.push(' '); if (blobURL) { ; __p.push(' '); if (!softwareDecode) { ; __p.push(' <audio id="audio" src="', blobURL ,'" episode="', episode.get('id') ,'" autoload></audio> <div id="time-info"> <span id="time-elapsed"></span> <span id="time-remaining"></span> <progress id="audio-progress"></progress> </div> '); } ; __p.push(' <a id="play-pause" href="#play-pause" data-paused="1" class="paused"><span class="hide">', l('Play/Pause') ,'</span></a> '); } ; __p.push(' <h2 class="podcast-title hide">', episode.podcast().get('name') ,'</h2> <h3 class="episode-title">', episode.get('title') ,'</h3> '); if (!!episode.get('description')) { ; __p.push(' <p class="description">', episode.get('description') ,'</p> '); } ; __p.push(''); } else { ; __p.push(' <h2 class="title">', l('Nothing play
'use strict';
// A very simple, key/value-based IndexedDB library for storing binary data
// in IndexedDB. Used because Podcasts needs to store large binary files (
// podcast image covers and audio files) but can't use Appcache or localStorage.
// Because most data is manipulated with Backbone.js and stored in localStorage
// though, we just use IndexedDB as blob storage.
//
// This library lets a user store arbitrary "big data" in IndexedDB with a
// stupid simple API:
E/GeckoConsole( 4371): [JavaScript Error: "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol." {file: "http://mozilla.github.io/high-fidelity/" line: 0}]
I/GeckoDump( 109): XXX FIXME : Got a mozContentEvent: webapps-install-granted
E/GeckoConsole( 109): Content JS INFO at app://system.gaiamobile.org/js/app_install_manager.js:197 in ai_handleDownloadError: downloadError event, error code is INVALID_SECURITY_LEVEL
I/Gecko ( 405): -- webapps.js uninstall http://mozilla.github.io/high-fidelity/manifest.webapp
I/Gecko ( 109): -- webapps.js uninstall http://mozilla.github.io/high-fidelity/manifest.webapp
E/GeckoConsole( 4371): [JavaScript Error: "msg is undefined" {file: "jar:file:///system/b2g/omni.ja!/components/Webapps.js" line: 532}]
# Instant server, anywhere!
server() {
python -m SimpleHTTPServer $1 && open "http://localhost:${1}"
}
@tofumatt
tofumatt / appcache.manifest
Last active December 19, 2015 03:19
Sample of Appcache manifest from Face Value (https://github.com/tofumatt/face-value)
CACHE MANIFEST
# v 0.1 / 12
CACHE:
css/app.css
img/coins/[email protected]
js/main.js
js/lib/require.js
NETWORK:
@tofumatt
tofumatt / localForage_use.js
Created June 29, 2013 03:51
Example of localForage use
var asyncStorage = require('localForage').asyncStorage;
function displayValue() {
asyncStorage.get('my_key', function(value) {
alert('My value is: ' + value);
});
}
// Notice we do this asynchronously, as all APIs here are async.
asyncStorage.set('my_key', 500, displayValue);
@tofumatt
tofumatt / network_test.js
Created June 29, 2013 05:57
Test for network connectivity
// We'll assume we aren't online.
var online = false;
// Assume we're a packaged app with systemXHR permissions.
// See: https://developer.mozilla.org/en-US/docs/Web/Apps/App_permissions for more.
var request = new window.XMLHttpRequest({mozSystem: true});
request.open('GET', 'http://mozilla.com', true);
request.addEventListener('load', function(event) {
console.log('We seem to be online!', event);
@tofumatt
tofumatt / crash_data.txt
Created October 30, 2013 05:01
Firefox OS Simulator Crash data
Process: firefox [2558]
Path: /Applications/Aurora.app/Contents/MacOS/firefox
Identifier: firefox
Version: 26.0a2 (2613.10.28)
Code Type: X86-64 (Native)
Parent Process: firefox [2518]
Responsible: firefox [2518]
User ID: 501
Date/Time: 2013-10-30 01:00:50.489 -0400