This file contains 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 { HttpLink } from "apollo-link-http"; | |
import { InMemoryCache } from "apollo-cache-inmemory"; | |
import apolloLogger from "apollo-link-logger"; | |
import { from } from "apollo-link"; | |
import { ApolloClient } from "apollo-client"; | |
const httpLink = new HttpLink({ | |
uri: "https://api.graph.cool/simple/v1/ck3h4yebx07690132c670msn3" | |
}); |
This file contains 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 ReactDOM from "react-dom"; | |
import { ApolloProvider } from "@apollo/react-hooks"; | |
import clientConfig from "./graphql.config"; | |
import "./index.css"; | |
import App from "./App"; | |
import * as serviceWorker from "./serviceWorker"; | |
ReactDOM.render( | |
<ApolloProvider client={clientConfig}> | |
<App /> |
This file contains 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
export default function (moduleName: any,graphql: any) { | |
let {mutations,queries} = graphql; | |
return { | |
subscriptions: graphql.subscriptions, | |
queries: { | |
[`list${moduleName}`]: async (_: any, args: any, g: any) => { | |
return queries[`list${moduleName}`](_,args,g); | |
}, | |
[`view${moduleName}`]: async (_: any, args: any, g: any) => { | |
return queries[`view${moduleName}`](_,args,g); |
This file contains 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
const functions = require("firebase-functions"); | |
const express = require("express"); | |
const { ApolloServer } = require("apollo-server-express"); | |
const { schema } = require("./graphql/index"); | |
const app = express(); | |
const server = new ApolloServer({ | |
schema | |
}); | |
server.applyMiddleware({ app, path: "/", cors: true }); |
This file contains 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
const admin = require("firebase-admin"); | |
const serviceAccount = require("./privatekey.json"); | |
admin.initializeApp({ | |
credential: admin.credential.cert(serviceAccount), | |
databaseURL: "FIREBASE_DATABASE" | |
}); | |
const DATABASE_NODE_USER = "users"; | |
const DATABASE_NODE_REF = admin.database(); |
This file contains 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
const { DATABASE_NODE_REF, DATABASE_NODE_USER } = require("./utils"); | |
const getUsers = () => | |
DATABASE_NODE_REF.ref(DATABASE_NODE_USER) | |
.once("value") | |
.then(snap => snap.val()) | |
.then(val => Object.keys(val).map(key => val[key])); | |
const addUser = async (_root, args) => { | |
const user = { |
This file contains 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
# remove specific file from git cache | |
git rm --cached filename | |
# remove all files from git cache | |
git rm -r --cached . | |
git add . | |
git commit -m ".gitignore is now working" |
This file contains 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
## To delete a local branch | |
git branch -d the_local_branch | |
## To remove a remote branch (if you know what you are doing!) | |
git push origin --delete the_remote_branch |
This file contains 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
export const getClosestStation = (lat, lng, data) => { | |
const results = []; | |
data.forEach(element => { | |
const _dummy = haversine(lat, lng, element.latitude, element.longitude); | |
results.push({ ...element, distance: _dummy }); | |
}); | |
const min = Math.min.apply( | |
null, | |
results.map(item => item.distance), | |
); |
This file contains 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
1. sudo netstat -antlp | grep <PORT> OR lsof -i:3000 | |
Ex: sudo netstat -antlp | grep 3002 | |
2. kill -9 <PID> | |
Ex: kill -9 18026 |
OlderNewer