Skip to content

Instantly share code, notes, and snippets.

View biancadanforth's full-sized avatar

Bianca Danforth biancadanforth

View GitHub Profile
biancadanforth / fxa-4418-unknown.diff
Last active January 11, 2022 12:37
FXA-4418 chore(auth): set state as "unknown" if it can't be determined
diff --git a/packages/fxa-auth-server/lib/payments/stripe.ts b/packages/fxa-auth-server/lib/payments/stripe.ts
index 23ef5812a..84be94e75 100644
--- a/packages/fxa-auth-server/lib/payments/stripe.ts
+++ b/packages/fxa-auth-server/lib/payments/stripe.ts
@@ -833,24 +833,9 @@ export class StripeHelper {
customerId: string;
postalCode: string;
country: string;
- }): Promise<boolean> {
- try {
biancadanforth / article-ruleset.js
Created January 5, 2022 23:08
Fathom article webpage ruleset
/* 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 */
/* eslint-disable max-len, arrow-body-style */
import {linearScale} from "fathom-web/utilsForFrontend";
import {dom, out, rule, ruleset, score, type} from "fathom-web";
const coefficients = {
"paragraph": [
biancadanforth / temp-fxa-3907-script.ts
Created September 20, 2021 14:53
FXA-3907 exploration: How many users are affected by off-session SCA?
/* 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 */
import { AuthLogger } from 'fxa-auth-server/lib/types';
import { ACTIVE_SUBSCRIPTION_STATUSES } from 'fxa-shared/subscriptions/stripe';
import { StatsD } from 'hot-shots';
import stripe from 'stripe';
import Container from 'typedi';
import { CurrencyHelper } from '../lib/payments/currencies';
biancadanforth /
Created June 10, 2021 17:08
Formula for computing a prorated upgrade charge amount in Stripe

If upgrading (say from a $10/month to a $20/month plan 3 days into the subscription):

  1. Calculate the fraction of the period used to this point under the previous plan, x.
3 days /30 days = 0.1 = x

Note: This is approximate, since months can have different numbers of days, there are leap years, etc.

  1. Multiply x by the previous plan's billing amount, amount_prev to get how much to credit the customer back, credit.
const fetch = require("node-fetch");
const config = {
paypal: require("./paypal-config")["DEV"],
const params = {
USER: config.paypal.USER, // Merchant username
PWD: config.paypal.PWD, // Merchant password
biancadanforth / call-paypal-api-requiring-bearer-token.js
Last active December 23, 2020 23:08
Fetching an ephemeral OAuth2 bearer token from PayPal sandbox when we don't have one or it's expired and then calling a PayPal API that requires the token.
const fetch = require("node-fetch");
const { getPayPalBearerToken } = require("../../github/bin/get-oauth2-token/bin/getOAuth2Token");
async function postToPayPalAPI(apiPath, body) {
const bearerToken = await getPayPalBearerToken();
const metadata = {
headers: {

What happens after Outreachy?

Disclaimer: These thoughts are my own (Bianca Danforth) based on my experience starting as an Outreachy at Mozilla and now working as a Senior Software Engineer.

Congratulations! You’ve just completed your Outreachy internship. You may be wondering: Where do I go from here? How do I get a job in software engineering? Below are a set of steps I recommend based on my own experience.


  • Identify goals
    • What are your professional goals?
    • If you're not sure where to start, ask other people you admire what their professional goals are.
  • Identify skills
  • What skills do you need to achieve your goals (those you already have, those that you need to improve, and those you need to learn)?
Last active May 11, 2020 00:07
Front End Performance and Profiling Team Session additional resources
biancadanforth / .hgrc.diff
Created March 24, 2020 19:54
Diff between my current ~/.hgrc and Mythmon's for `alias`, `revsetalias` and `templates`
diff --git a/Users/bdanforth/.hgrc b/Users/bdanforth/.hgrc-mythmon
index d2d9e52..e32a8cb 100644
--- a/Users/bdanforth/.hgrc
+++ b/Users/bdanforth/.hgrc-mythmon
@@ -26,13 +26,11 @@ absorb =
js-format = /Users/bdanforth/.mozbuild/version-control-tools/hgext/js-format
shelve =
-wip = log --graph --rev=wip --template=wip
-smart-annotate = annotate -w --skip ignored_changesets
biancadanforth / Improve ruleset performance with mostly low hanging
Last active March 24, 2020 02:09
Draft issue to file on mozilla-services/fathom-login-forms to improve model performance

Since Bug 1595244 landed yesterday (based on the model at bff6995c), we have started to get some telemetry regarding how long it takes to show the password generation UI. We also did some profiling this afternoon. Taking both of these together, we think it would be prudent to make some relatively straightforward changes to the ruleset to improve its performance.

The following numbers are based on profiling Nightly, taking an average of 5 runs for a locally hosted registration page. Taken together, these sets of changes would speed up the model by about 42%, and there may be more low hanging fruit as well.

The diff below would speed up the model by about 25%. This would not require any retraining.

diff --git a/toolkit/components/passwordmgr/NewPasswordMode