Skip to content

Instantly share code, notes, and snippets.

View brygrill's full-sized avatar

Bryan Grill brygrill

View GitHub Profile
# checkout remote branch
$ git fetch
$ git checkout <remote-branch-name>

# list local branches
$ git branch

# list all branches
$ git branch -a
Update Packages
$ sudo apt-get update
$ sudo apt-get -y upgrade
$ sudo apt-get dist-upgrade

via askubuntu

Install .deb
@brygrill
brygrill / firebase-graphql-basic.js
Last active August 4, 2020 14:12
Deploying a GraphQL Server with Firebase Functions
// sample graphql server deployed with firebase functions
// minimal server setup
// via http://graphql.org/graphql-js/running-an-express-graphql-server/
const functions = require('firebase-functions');
const express = require('express');
const graphqlHTTP = require('express-graphql');
const { buildSchema } = require('graphql');
// Init express
const app = express();
@brygrill
brygrill / firebase-graphql-with-data.js
Last active March 3, 2021 23:00
Deploying a GraphQL Server with Firebase Functions
// sample graphql server deployed with firebase functions
// pulling some basic stockmarket data from a firebase db
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const express = require('express');
const graphqlHTTP = require('express-graphql');
const values = require('lodash.values');
const { GraphQLSchema, GraphQLObjectType, GraphQLList, GraphQLString } = require('graphql');
// Init express
@brygrill
brygrill / standard-http-function.js
Last active June 23, 2017 19:15
Deploying a GraphQL Server with Firebase Functions
// via https://github.com/firebase/functions-samples/blob/master/quickstarts/big-ben/functions/index.js
const functions = require('firebase-functions');
// endpoint would be the <the url firebase gives you>/bigben
exports.bigben = functions.https.onRequest((req, res) => {
// you have access to standard express req and res inside function
const hours = (new Date().getHours() % 12) + 1; // london is UTC + 1hr;
res.status(200).send(`<!doctype html>
<head>
<title>Time</title>
const typeDefs = `
scalar Coordinates
type PointGeometry {
type: String!
coordinates: Coordinates!
}
type PointProps {
id: Int!
new GraphQLScalarType({
// Thanks:
// https://github.com/ghengeveld/graphql-geojson/blob/master/index.js#L46
// https://github.com/apollographql/graphql-tools/blob/master/docs/source/scalars.md
name: 'Coordinates',
description: 'A set of coordinates. x, y',
parseValue(value) {
return value;
},
serialize(value) {
// mock data
const data = [
{ vehicleid: 1, latitude: 40.1, longitude: -76.5 },
{ vehicleid: 2, latitude: 40.2, longitude: -76.6 },
{ vehicleid: 3, latitude: 40.3, longitude: -76.7 }
]
const resolvers = {
Coordinates: new GraphQLScalarType({
name: 'Coordinates',
// App.js
const App = () => {
// state
const [authed, setAuthed] = useState(false);
// render
// if not authed display signin page
if (!authed) {
return <SignIn />;