Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import { GraphQLField, DirectiveNode, TypeNode, isNonNullType } from "graphql";
type FieldVisitorFn = (
field: GraphQLField<any, any>,
argumentDirectives: {
directiveNode: DirectiveNode,
targetNode: TypeNode,
path: string
}[]
) => GraphQLField<any, any> | void | null;
@alexstrat
alexstrat / components.md
Last active April 29, 2020 09:47
EGG - Sprint 0: Onboarding

React components

EGG components

<WelcomeScreen />

Re-use common’s <Button /> (might need adaptation to have an icon inside)

Props

onPressGetStarted: () => void
import { readFileSync, writeFileSync } from 'fs';
import { load } from 'cheerio';
import { html as beautify } from 'js-beautify';
const content = readFileSync('./static/Icons.svg', 'utf8');
const $ = load(content);
$('svg').find('symbol').each((i, symbol) => {
const id = $(symbol).attr('id')!.split('--')[1];
symbol.tagName = 'svg';
diff --git a/cli/migrate-user-from-auth0-to-firebase.ts b/cli/migrate-user-from-auth0-to-firebase.ts
new file mode 100644
index 0000000..2daa70e
--- /dev/null
+++ b/cli/migrate-user-from-auth0-to-firebase.ts
@@ -0,0 +1,72 @@
+import { ArgumentParser } from 'argparse';
+import { hashSync } from 'bcrypt';
+import { initFirebase } from '../src/authentication/firebase/helpers';
+import * as firebaseAdmin from 'firebase-admin';
diff --git a/package.json b/package.json
index 6075c4c..da958f0 100644
--- a/package.json
+++ b/package.json
@@ -26,6 +26,7 @@
"@types/react": "^16.9.13",
"@types/react-dom": "^16.9.4",
"@types/react-jss": "^10.0.0",
+ "@types/react-router-dom": "^5.1.3",
"@types/terser-webpack-plugin": "^2.2.0",
/* use with https://github.com/menduz/node-ebnf Custom grammar */
{ ws=implicit }
MojomFile ::= StatementList
StatementList ::= Statement*
Statement ::= ModuleStatement | ImportStatement | Definition
ModuleStatement ::= AttributeSection? "module" WS+ Identifier ";"
ImportStatement ::= "import" WS+ StringLiteral ";"
Definition ::= Struct | Union | Interface | Enum | Const
@alexstrat
alexstrat / README.md
Last active November 27, 2018 08:07
Mojom example 2

Overview

Local usage

import { Heartbeat } from './math.ts'
import { HeartbeatImpl } from './MathImpl'

const heartbeat = new Heartbeat(new HeartbeatImpl());
@alexstrat
alexstrat / README.md
Last active November 23, 2018 17:50
Mojom example

Overview

  • math.mojom is the definition of the service
  • math.ts is auto-generated code based on Mojo definition: it gives a stub and a type definition of an implementation
  • mathImpl.ts is an actual implementation of Math service.
  • mathRPC.ts is the necessary code to call a remote implementation of Math service via JSON-RPC (using a RPCPeer). It can be auto-generated as well.

In the best world, dev just have to define math.mojom and implement mathImpl.ts, the logic of the service. The rest is code-generated.

Local usage

// StorageService.proto
service StorageService {
  rpc readKey(ReadRequest) returns (ReadReply) {}
}

message ReadRequest {
  string type;
  string key;
}