Skip to content

Instantly share code, notes, and snippets.

@jthegedus
jthegedus / .bashrc
Last active March 6, 2017 12:40
The .bashrc for my development Ubuntu 16.04 machine. (edited to shorten the bash terminal output)
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@jthegedus
jthegedus / StayFocusd Settings
Last active October 16, 2018 02:04
StayFocusd web browser extension settings
## Active Days:
all except Saturday
## Active Hours:
12am-10pm
## Blocked Sites:
bbc.co.uk
cnn.com
collegehumor.com
@jthegedus
jthegedus / CFF|helloWorld.js
Last active May 27, 2017 05:26
Cloud Functions for Firebase - HelloWorld
var functions = require("firebase-functions")
exports.helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!")
})
@jthegedus
jthegedus / CF4F-ES6|functionsES6|index.js
Last active October 9, 2017 13:26
Cloud Functions for Firebase - ES6
import * as functions from "firebase-functions"
export let helloWorld = functions.https.onRequest((req, res) => {
let world = `from ES6 in Cloud Functions!`
res.status(200).send(`Hello ${world}`)
})
@jthegedus
jthegedus / CF4F-ES6|package.json
Last active October 9, 2017 13:30
Cloud Functions for Firebase - ES6 pkg json
{
"name": "firebase-functions-es6-example",
"version": "1.0.0",
"description": "Use ES6 to develop Cloud Functions for Firebase today!",
"repository": "https://github.com/jthegedus/firebase-functions-es6-example.git",
"license": "MIT",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"rimraf": "^2.6.2",
@jthegedus
jthegedus / CF4F-ES6|functionsES6|package.json
Last active October 9, 2017 13:31
Cloud Functions for Firebase - ES6 example functionsES6/package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"dependencies": {
"firebase-admin": "^5.4.1",
"firebase-functions": "^0.7.0"
},
"private": true
}
@jthegedus
jthegedus / CF4F-graphql|firebaseFunctions|index.js
Last active October 9, 2017 14:37
Cloud Functions for Firebase - GraphQL Server - /functionsES6/index.js
import { https } from "firebase-functions"
import setupGraphQLServer from "./graphql/server"
/* CF for Firebase with graphql-server-express */
const graphQLServer = setupGraphQLServer()
// https://us-central1-<project-name>.cloudfunctions.net/api
export const api = https.onRequest(graphQLServer)
@jthegedus
jthegedus / CF4F-graphql|firebaseFunctions|package.json
Last active October 9, 2017 14:37
Cloud Functions for Firebase - GraphQL Server - /functionsES6/package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"dependencies": {
"apollo-server-express": "^1.1.3",
"body-parser": "^1.18.2",
"express": "^4.16.1",
"firebase-admin": "^5.4.1",
"firebase-functions": "^0.7.0",
"graphql": "^0.11.7",
@jthegedus
jthegedus / CF4F-graphql|firebaseFunctions|graphql|server.js
Last active April 1, 2018 08:43
Cloud Functions for Firebase - GraphQL Server - /functionsES6/graphql/server.js
import bodyParser from "body-parser"
import express from "express"
import { graphqlExpress, graphiqlExpress } from "graphql-server-express"
import schema from "./data/schema"
import { printSchema } from "graphql/utilities/schemaPrinter"
const setupGraphQLServer = () => {
// setup server
const graphQLServer = express()
@jthegedus
jthegedus / CF4F-graphql|firebaseFunctions|graphql|data|schema.js
Last active October 9, 2017 14:38
Cloud Functions for Firebase - GraphQL Server - /functionsES6/graphql/data/schema.js
import { makeExecutableSchema } from "graphql-tools"
import resolvers from "./resolvers"
const schema = `
type Author {
id: Int! # the ! means that every author object _must_ have an id
firstName: String
lastName: String
posts: [Post] # the list of Posts by this author