Skip to content

Instantly share code, notes, and snippets.

View zaach's full-sized avatar
🎯
Focusing

Zach Carter zaach

🎯
Focusing
View GitHub Profile
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2014-01-28 23:48+0000\n"
"Content-Type: text/plain;\n"
> fxa-content-server@0.0.1 test /Users/zcarter/moz/fxa-content-server
> intern-runner config=tests/intern
Defaulting to "runner" reporter
Listening on 0.0.0.0:9090
Initialised phantomjs 1.9.2 on mac-10.8 (Mountain Lion)-32bit
Test main - sign_in - sign in FAILED on phantomjs 1.9.2 on mac-10.8 (Mountain Lion)-32bit:
Error: Timeout reached on main - sign_in - sign in
at Error (<anonymous>)
at new ErrorCtor (/Users/zcarter/moz/fxa-content-server/node_modules/intern-geezer/node_modules/dojo/errors/create.js:13:21)
var PREFIX_NAME = "identity.mozilla.com/picl/v1/";
var bitSlice = sjcl.bitArray.bitSlice;
function deriveHawkCredentials(tokenHex, context, size) {
var token = sjcl.codec.hex.toBits(tokenHex);
var info = sjcl.codec.utf8String.toBits(PREFIX_NAME + context);
return hkdf(token, info, undefined, size || 3 * 32)
.then(function(out) {
var authKey = bitSlice(out, 8 * 32, 8 * 64);
@zaach
zaach / sample.js
Last active December 26, 2015 10:08
var client = new gherkin.Client('http://127.0.0.1:9000');
function queryAccount(email, cb) {
return client.accountExists(email)
.done(
function (exists) {
var status = exists ? "registered" : "unregistered";
cb(null, { status: status });
},
function (error) {
cb({ error: error.message });
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var Client = require('./gherkin');
var crypto = require('crypto');
var email = crypto.randomBytes(4).toString('hex') + '@example.com';
var password = 'verySecurePassword';
var publicKey = {
$ ./mach build
0:00.12 /usr/bin/make -f client.mk -s
0:00.34 Adding client.mk options from /Users/zcarter/moz/b2g-src/mozilla-central/.mozconfig:
0:00.34 MOZ_OBJDIR=../build_mc
0:00.34 MOZ_MAKE_FLAGS=-s -j6
0:00.50 Clobber not needed.
0:00.53 cd ../build_mc
0:00.54 /Users/zcarter/moz/b2g-src/mozilla-central/configure
0:00.61 Adding configure options from /Users/zcarter/moz/b2g-src/mozilla-central/.mozconfig:
0:00.61 --enable-application=browser
jwcrypto.assertion.sign(
{}, {audience: audience, expiresAt: expirationDate},
secretKey,
function(err, signedAssertion) {
var assertion = jwcrypto.cert.bundle([cert], signedAssertion);
});
@zaach
zaach / map-reduce.js
Last active December 20, 2015 17:19
Map reduce with p-promises, based on https://gist.github.com/kriskowal/359801
// Map/Reduce with Promises
var p = require("p-promise");
// to simulate a long latency, promise-returning API
var delay = function (timeout) {
var deferred = p.defer();
setTimeout(function () {
deferred.resolve();
}, timeout);
return deferred.promise;
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.github.com/tammomueller/5769498/raw/7a1a21c6c437484c07d45147faad5f7ad480e6e2/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@zaach
zaach / gist:5061155
Last active December 22, 2022 19:06
Taming Configurations with node-convict

Taming Configurations with node-convict

In this installment of "A Node.JS Holiday Season" series we'll take a look at node-convict, a tool to help manage the configuration of node.js applications.

There are two main concerns regarding application configuration:

  • Most applications will have at least a few different deployment environments, each with their own configuration needs.
  • Including credentials and sensitive information in source can be problematic.