Skip to content

Instantly share code, notes, and snippets.

@dannycoates
dannycoates / proposal.md
Last active May 29, 2024 16:36
Typescript Conversion Plan

A (proposed) plan for Typescript

“How did you go bankrupt?” Bill asked. “Two ways,” Mike said. “Gradually and then suddenly.”
  - Hemingway

Goals

  • Convert the olapui repo to Typescript leaving zero Flow
/* 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/. */
/* eslint jest/valid-expect: 0 */
import React from 'react';
import { render, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
@dannycoates
dannycoates / profile.patch
Created October 23, 2019 17:15
oauth->auth fxa-dev-launcher profile patch
diff --git a/profile.js b/profile.js
index f4d426a..410d5dc 100644
--- a/profile.js
+++ b/profile.js
@@ -7,7 +7,7 @@ var CONFIGS = {
content: 'http://127.0.0.1:3030/',
token: 'http://localhost:5000/token/1.0/sync/1.5',
loop: 'http://localhost:10222',
- oauth: 'http://127.0.0.1:9010/v1',
+ oauth: 'http://127.0.0.1:9000/v1',
@dannycoates
dannycoates / auth-server.log
Created October 18, 2019 16:19
redis conflict
10|auth-server key server PORT 9000 | fxa-auth-server.INFO: request.summary {"status":200,"errno":0,"path":"/v1/session/verify_code","lang":"en-US,en;q=0.5","agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:69.0) Gecko/20100101 Firefox/69.0","remoteAddressChain":["127.0.0.1"],"t":230,"uid":"2bacd9c2fcba41ab8fb69186f55516ba","service":"sync","keys":false,"method":"post","email":"qwe@qwe.com"}
10|auth-server key server PORT 9000 | fxa-auth-server.INFO: flowEvent {"event":"route./session/verify_code.200","locale":"en","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:69.0) Gecko/20100101 Firefox/69.0","time":1571415144380,"device_id":"9eb4f240d1de4776983ae194edd22d70","flow_id":"4e20a331e2f748f421f0d03c3bcac3f11e6d8798f27312394ebc169523fd4d6b","flow_time":37413,"flowBeginTime":1571415106967,"flowCompleteSignal":"account.signed","flowType":"registration","service":"sync","entrypoint":"fxa_discoverability_native","uid":"2bacd9c2fcba41ab8fb69186f55516ba"}
10|auth-server key server PORT 9000 |
const parseDiff = require('diffparser');
const fetch = require('node-fetch');
const { moduleDependencies } = require('../package.json').fxa;
function moduleName(path) {
const parts = path.split('/');
return parts.length > 1 ? parts[0] : 'root';
}
async function getModules(org, repo, branch) {
class BlobSlicer {
constructor(blob, size) {
this.blob = blob
this.size = size
this.index = 0
}
start(controller) {}
pull(controller) {
return new Promise((resolve, reject) => {
diff --git a/frontend/src/app/containers/App/index.js b/frontend/src/app/containers/App/index.js
index 5d34ca2d..b2b3197a 100644
--- a/frontend/src/app/containers/App/index.js
+++ b/frontend/src/app/containers/App/index.js
@@ -1,7 +1,7 @@
/* global ga */
import { MessageContext } from "fluent/compat";
import { negotiateLanguages } from "fluent-langneg/compat";
-import { LocalizationProvider } from "fluent-react/compat";
+import { LocalizationProvider, isReactLocalization } from "fluent-react/compat";
<!DOCTYPE html5>
<html>
<body>
<script>
const HMAC_SHA256 = { name: 'HMAC', hash: {name: 'SHA-256'}};
const UTF8 = new TextEncoder('utf-8');
function b64(arrayBuffer) {
return btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)))
}
var ece = require('http_ece');
var crypto = require('crypto');
var base64 = require('base64url');
var parameters = {
key: base64.encode(crypto.randomBytes(16)),
salt: base64.encode(crypto.randomBytes(16))
};
const data = new Buffer('hello, world!', 'utf8');
class Storage {
constructor(engine) {
this.engine = engine
}
get totalDownloads() {
return Number(this.engine.getItem('totalDownloads'))
}
set totalDownloads(n) {
this.engine.setItem('totalDownloads', n)