Skip to content

Instantly share code, notes, and snippets.

@callahad
callahad / Dockerfile
Last active November 15, 2022 17:57
Preliminary Firefox Sync Dockerfile
FROM debian:7.4
MAINTAINER Dan Callahan <dan.callahan@gmail.com>
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
vim curl locales \
&& apt-get clean
RUN locale-gen C.UTF-8 && LANG=C.UTF-8 /usr/sbin/update-locale
ENV LANG C.UTF-8

Keybase proof

I hereby claim:

  • I am callahad on github.
  • I am callahad (https://keybase.io/callahad) on keybase.
  • I have a public key whose fingerprint is 45A9 53A2 E442 7B8A 68D1 7CED 6E4A 6E96 560C 0D96

To claim this, I am signing this object:

@callahad
callahad / 0 - README.md
Last active August 12, 2016 13:11
ES7 Async to ES6 via Babel

These snippets show several different ways of accomplishing the same asynchronous task: fetching a document and reporting the status code.

  1. Using callbacks.
  2. Using ES2015 Promises directly.
  3. Using ES7 Async/Await, which is just syntactic sugar for Promises.

The third example is the future, and will likely start landing in runtimes soon. You can use it today thanks to Babel, as snippets #4 and #5 show.

@callahad
callahad / discovery.md
Created November 26, 2013 14:58
Authority discovery draft.

Authority Discovery

To discover the authoritative Identity Provider for a given email address:

  1. Extract the domain name from the email address and remember this as the Original Domain.

  2. Using HTTPS, attempt to GET /.well-known/browserid from the Original Domain.

  3. Depending on the response:

@callahad
callahad / api-rp.md
Created November 25, 2013 22:49
Proposed Goldilocks API spec

Relying Party (RP) API

navigator.id.watch( parameters )

Configure BrowserID by registering callbacks and setting display options.

Implementation Notes:
@callahad
callahad / goldilocks-api.js
Created October 3, 2013 10:22
Prototype of the proposed "Goldilocks API" for Persona.
(function () {
/* License: MPL 2.0.
*
* This polyfill implements the proposed "Goldilocks API" for Persona atop the
* existing "Observer API."
*
* Usage:
* 1. Configure Persona:
*
* navigator.id.watch({
@callahad
callahad / lctdjs-persona.js
Last active December 23, 2015 15:09
Let's Code Test Driven JavaScript's Persona integration.
// Copyright (c) 2012-2013 Titanium I.T. LLC. All rights reserved.
/*global window, document, navigator, XMLHttpRequest, alert, setupPersona, $*/
(function() {
"use strict";
var ready = false;
window.setupPersona = function(email) {
$(".tdjs-signin").click(onSignin);
@callahad
callahad / disable-session-hints.patch
Created September 3, 2013 21:31
Disable Persona session hints
From 21d898eb00cbcb1ffcab7d5e0ec01a4e80499ea5 Mon Sep 17 00:00:00 2001
From: Dan Callahan <dan.callahan@gmail.com>
Date: Tue, 3 Sep 2013 16:30:44 -0500
Subject: [PATCH] Hack to ignore Persona session hints
---
mediagoblin/plugins/persona/static/js/persona.js | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/mediagoblin/plugins/persona/static/js/persona.js b/mediagoblin/plugins/persona/static/js/persona.js
@callahad
callahad / persona-tweaks.patch
Last active December 22, 2015 06:09
MediaGoblin / Persona siteName, siteLogo, and backgroundColor patch
From a7c2105e2940ef037600de92faee1e33610440b2 Mon Sep 17 00:00:00 2001
From: Dan Callahan <dan.callahan@gmail.com>
Date: Tue, 3 Sep 2013 15:31:28 -0500
Subject: [PATCH] Add site name, logo, and background for Persona
---
mediagoblin/plugins/persona/static/js/persona.js | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/mediagoblin/plugins/persona/static/js/persona.js b/mediagoblin/plugins/persona/static/js/persona.js
@callahad
callahad / QR.go
Created July 17, 2013 03:32
The Golang stage from mame/quine-relay, after running through the gofmt pretty printer.
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Print("print\x27" + strings.Replace("import Data.Char@nmain=putStrLn$@\"procedure main();write(@@@\"DO,1<-#@\"++show(length s)++f s 1 0;f(x:t)i c=let v=foldl(@@a x->a*2+(mod x 2))0$take 8$iterate(flip div 2)$Data.Char.ord x in(if mod i 4<1then@\"PLEASE@\"else@\"@\")++@\"DO,1SUB#@\"++show i++@\"<-#@\"++show(mod(c-v)256)++@\"@@@@n@\"++f t(i+1)v;f[]_ _=@\"PLEASEREADOUT,1@@@@nPLEASEGIVEUP@@@\");end@\";s=(@\".class public QR@@n.super java/lang/Object@@n.method public static main([Ljava/lang/String;)V@@n.limit stack 2@@ngetstatic java/lang/System/out Ljava/io/PrintStream;@@nldc @@@\"class QR{public static void main(String[]v){String c[]=new String[8000],y=@@@@@@@\"@@@@@@@\",z=y,s=@@@@@@@\"+q,T+n,J,O,U,F,S,O,B,M+L,D,P,O,T,U,B,i,;+d+e+c+e+h+L,Y+L,J+i,=,D+N,0,2+z,.,4+L,<+c+c,Q,S,h,U,<+f+t+T-C+t-;+c,n,M+k-G-G,O-G+4+q->-A,G-G+L+Q,T-W-N-D-N-<+Z,B,T,T,F,N,C,M,Z-W-B-D,a-G,c+Z,N,F,U,I,P,E-W,t,B,U,J,D-W,W,P,J-z-D+L,-,B,h-G-F-D+U-G,a+Z,F,i,S,Z,Q.2,i-W,M,E,t,S-a-H-