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 / 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 / CFF-next|.firebaserc
Created July 20, 2017 15:05
Cloud Functions for Firebase - NextJS example
{
"projects": {
"default": "this will be the name you gave to the firebase project you linked"
}
}
@jthegedus
jthegedus / CFF-next|functions|index.js
Last active July 21, 2017 15:23
Cloud Functions for Firebase - NextJS example
const functions = require("firebase-functions")
const next = require("next")
var dev = process.env.NODE_ENV !== "production"
var app = next({ dev, conf: { distDir: "next" } })
var handle = app.getRequestHandler()
exports.next = functions.https.onRequest((req, res) => {
console.log("File: " + req.originalUrl) // log the page.js file that is being requested
return app.prepare().then(() => handle(req, res))
@jthegedus
jthegedus / CFF-next|functions|.gitignore
Last active July 25, 2017 05:05
Cloud Functions for Firebase - NextJS example
# src/functions/.gitignore
next
@jthegedus
jthegedus / CFF-next|firebase.json
Created July 25, 2017 08:42
Cloud Functions for Firebase - NextJS example
{
"hosting": {
"public": "src/public",
"rewrites": [
{
"source": "**/**",
"function": "next"
}
]
},
@jthegedus
jthegedus / CFF-next|.gitignore
Last active July 25, 2017 10:15
Cloud Functions for Firebase - NextJS example
# src/app/.gitignore
.next
@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
}