Skip to content

Instantly share code, notes, and snippets.

View daviddahl's full-sized avatar
💭
burning the midnight oil

David Dahl daviddahl

💭
burning the midnight oil
View GitHub Profile
/* -*- Mode: js2; js2-basic-offset: 2; indent-tabs-mode: nil; -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
@daviddahl
daviddahl / gist:1095855
Created July 20, 2011 20:31 — forked from jonleighton/base64ArrayBuffer.js
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
function base64ArrayBuffer(arrayBuffer) {
var base64 = ''
var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
var bytes = new Uint8Array(arrayBuffer)
var byteLength = bytes.byteLength
@daviddahl
daviddahl / chatter.js
Created July 25, 2011 21:56
chatter.js
// Encrypt chat bookmarklet
// Author: David Dahl <ddahl@mozilla.com>
// (function (){ var e = document.createElement("script"); e.src = "https://raw.github.com/gist/1105340/88e82d098691fbc1d1ba37ca6ed7c9d5aef97c1c/chatter.js?t=" + Date.now(); document.body.appendChild(e);}());
function Chatter()
{
var DEBUG = false;
var self = this;
@daviddahl
daviddahl / recycle.js
Created August 30, 2012 16:25
recycle collection data
function RecyclingDataCollector(){}
RecyclingDataCollector.prototype = {
collectWeight: function _collectWeight(type, weight, max)
{
var err;
if (!weight || !type) {
error("Weight and Type are required args");
}
var result;
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
@daviddahl
daviddahl / bridgeapi.js
Created October 10, 2012 19:43
DOM Crypto "Bridge" API
//
@daviddahl
daviddahl / nsINaCl.diff
Created March 7, 2013 03:17
NaCl in Gecko: Brian Warner and David Dahl
diff --git a/security/manager/ssl/public/Makefile.in b/security/manager/ssl/public/Makefile.in
index 07eedf7..4269d53 100644
--- a/security/manager/ssl/public/Makefile.in
+++ b/security/manager/ssl/public/Makefile.in
@@ -102,6 +102,7 @@ XPIDLSRCS = \
nsIKeyModule.idl \
nsIProtectedAuthThread.idl \
nsIDataSignatureVerifier.idl \
+ nsINACL.idl \
$(NULL)
@daviddahl
daviddahl / process_cookie_data.py
Created August 13, 2013 21:17
Processing code for cookie study stored in Hadoop
@daviddahl
daviddahl / tests-working
Created March 4, 2014 17:40
Crypton tests diff
diff --git a/server/Makefile b/server/Makefile
index ff9bdc7..210a5b5 100644
--- a/server/Makefile
+++ b/server/Makefile
@@ -3,6 +3,9 @@ test: test-unit
test-unit: clean node_modules
@NODE_ENV=test ./node_modules/.bin/mocha -R spec
+test-debug: clean node_modules
+ @NODE_ENV=test ./node_modules/.bin/mocha -R spec -d --debug-brk

Keybase proof

I hereby claim:

  • I am daviddahl on github.
  • I am ddahl (https://keybase.io/ddahl) on keybase.
  • I have a public key whose fingerprint is 0FF0 2B5E 7148 FA97 0A22 0C12 4BA5 2DBB 2ADE D0CD

To claim this, I am signing this object: