This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import * as firebase from "firebase"; | |
import "firebase/firestore"; | |
const config = { | |
apiKey: "AIzaSyD", | |
authDomain: "react-native.firebaseapp.com", | |
databaseURL: "https://react-native.firebaseio.com", | |
projectId: "react-native", | |
storageBucket: "react-native.appspot.com", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expo init $1 | |
cd $1 | |
yarn add @types/expo eslint eslint-config-react-native-wcandillon --dev | |
mv App.js App.tsx | |
curl -O https://gist.githubusercontent.com/wcandillon/10f40b913f1c63f357169b97473f9eb2/raw/45c677856ae512cbb8db41308de72d149fded5b4/tsconfig.json | |
curl -O https://gist.githubusercontent.com/wcandillon/f734fb532bffec0abc436749dd46c4bf/raw/c33de2df4b4fb4dec0b6f44e6aa1ceb5d7004141/.eslintrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { | |
StyleSheet, | |
Text, | |
View, | |
ScrollView, | |
Animated, | |
SafeAreaView, | |
Dimensions | |
} from "react-native"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import * as React from "react"; | |
import {Shaders, Node} from "gl-react"; | |
import resolveAssetSource from "react-native/Libraries/Image/resolveAssetSource"; | |
const shaders = Shaders.create({ | |
Brannan: { | |
frag: `...` | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fb from "firebase"; | |
import { computed, observable, runInAction } from "mobx"; | |
type Query = fb.firestore.Query; | |
type DocumentReference = fb.firestore.DocumentReference; | |
type DocumentSnapshot = fb.firestore.DocumentSnapshot; | |
type LoadingDocumentSnapshot = DocumentSnapshot | undefined; | |
type Dictionary<T> = { [key: string]: T }; | |
// type QuerySnapshot = fb.firestore.QuerySnapshot; | |
// type LoadingCollectionSnapshot = QuerySnapshot | undefined; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {User} from "./Model"; | |
type Snapshot = firebase.database.DataSnapshot; | |
export default class UserStore { | |
constructor() { | |
FirebaseProvider.get().currentUserDBRef.on("value", (snapshot: Snapshot) => { | |
this.user = snapshot.val() as User; | |
}); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import module namespace fb = "http://wcandillon.io/modules/firebase" at "firebase.jq"; | |
declare variable $token as string external; | |
for $uid in fb:get("users.json", $token) ! keys($$) | |
for $eid in fb:get("users/" || $uid || "/feed.json", $token) ! keys($$) | |
for $uri in ( | |
"feed/" || $eid, | |
"users/" || $uid || "/feed/" || $eid, | |
"comments/" || $eid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module namespace fb = "http://wcandillon.io/modules/firebase"; | |
import module namespace http = "http://zorba.io/modules/http-client"; | |
declare namespace an = "http://zorba.io/annotations"; | |
declare variable $admin:firebase-endpoint := "https://myapp.firebaseio.com/"; | |
declare %an:nondeterministic function fb:get($document-uri as string, $token as string) { | |
http:get( | |
$admin:firebase-endpoint || $document-uri || "?auth=" || $token | |
).body.content ! parse-json($$) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run — rm -v $(pwd)/admin:/queries fcavalieri/zorba -q migrate.jq -f -i -e token:=$FIREBASE_SECRET |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Generate Typescript data model | |
firebase-bolt-transpiler < rules.bolt > src/Model.ts |