Skip to content

Instantly share code, notes, and snippets.

@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.")

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.

{
"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" }
}
@sfoster
sfoster / pisync.sh
Last active January 29, 2016 16:51
#!/bin/bash
# synch files across a local project directory to a remote server
# place pisync.sh at the top of your project directory, or alias it
# ip or hostname of the pi
REMOTE_HOST=10.0.1.15
# path to the project directory on the pi
PROJECT=/home/pi/mirror
BASE_DIR=$(dirname $(readlink -f $0))
@sfoster
sfoster / inputs_outputs.md
Created April 8, 2016 00:30
SmartHome inputs/outputs

Inputs

  • Keyboard
  • Touch (capacitive touch, alternatives?)
  • Voice (offline, online)
  • OCR
  • Image Analysis (e.g. Kinnect, face recognition)
  • Sensor input (buttons, motion, temperature, light etc)
  • RFID/NFC <-- needs investigation & prototyping
  • Feeds & Events (e.g. news feeds, weather APIs etc)
<!DOCTYPE html>\n
<html>
<head>
<title>Example status client</title>
<style>
.led {
width: 40px;
height: 40px;
display: inline-block;
}
@sfoster
sfoster / svg-animation-tooling.md
Last active July 5, 2018 20:40
SVG Animation Tooling / Firefox Photon Notes

Many of the new UI animations added in 57 used a "film strip" technique to get pre-rendered, 60fps animation that could run entirely on the compositor and off the main thread. These SVG files were typically a horizontal strip of frames, each frame offset on the x-axis by frame index * frame width. To play the animation, the CSS transform property is updated to translateX to a value that places the current frame at 0,0 in a cropped element. This technique is explained and illustrated here: http://msuja.ws/svg.html

There are many ways to create and optimize the output assets for these animations. The toolchain we used was a mix of existing tools and custom scripts and processes:

Asset preparation process

  • Adobe After Effects + BodyMovin
    • The framing and motion design was doine in After Effects, and exported using the BodyMovin plugin to a SVG-as-json format.
  • This page imports this json data, creates a SVG document and plays the animation in order to gen
@sfoster
sfoster / gist:9c9230cba4e4cff1eb88423cd9547e51
Created November 26, 2018 23:40
Some form autofill scratchpad code to enter some test addresses and credit card details
/*
* This is a JavaScript Scratchpad.
*
* Enter some JavaScript, then Right Click or choose from the Execute Menu:
* 1. Run to evaluate the selected text (Ctrl+R),
* 2. Inspect to bring up an Object Inspector on the result (Ctrl+I), or,
* 3. Display to insert the result in a comment after the selection. (Ctrl+L)
*/
const cardBobsVisa = {
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Test login capture on form removal</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
@sfoster
sfoster / slow-response.js
Created August 12, 2021 20:46
Server to throttle response to a .zip file request so you can easily work on downloads without filling up your disk
const express = require('express');
const cwd = process.cwd();
const path = require('path');
const docRoot = cwd;
const app = express();
const port = 3000;
const fs = require('fs');
const Throttle = require('stream-throttle').Throttle;
app.get('/*.zip', async function(request, response, next) {