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
# om namah shivay | |
machine: | |
node: | |
# current node version running in cloud functions as of 02 Jan 2018. see https://cloud.google.com/functions/docs/writing | |
version: 6.11.5 | |
dependencies: | |
pre: | |
# see https://cloud.google.com/sdk/gcloud/reference | |
- sudo /opt/google-cloud-sdk/bin/gcloud components update --quiet |
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
// om namah shivay | |
// environment variables | |
const FB_APP_SECRET = 'your facebook app secret'; | |
// requires | |
const crypto = require('crypto'); | |
const verifyXHubSignature = req => { | |
const digest = crypto |
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
// om namah shivay | |
// run gcloud beta functions deploy gcf-runtime-configurator --entry-point start --trigger-http | |
// to deploy this function to gcf using the gcloud tool | |
const start = (req, res) => { | |
let html; | |
if (!global.config) { | |
loadConfig() | |
.then(result => { |
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
{ | |
"development": { | |
"config_id": "development", | |
"app_name": "my app", | |
"app_desc": "my app desc", | |
"node_port": 3000, | |
"json_indentation": 4, | |
"database": "my-app-db-dev" | |
}, | |
"testing": { |
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
// om namah shivay | |
// requires | |
const _ = require('lodash'); | |
// module variables | |
const config = require('./config.json'); | |
const defaultConfig = config.development; | |
const environment = process.env.NODE_ENV || 'development'; | |
const environmentConfig = config[environment]; |
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
// om namah shivay | |
// requires | |
const express = require('express'); | |
// environment variables | |
process.env.NODE_ENV = 'development'; | |
// uncomment below line to test this code against staging environment | |
// process.env.NODE_ENV = 'staging'; |
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
{ | |
/* | |
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
"Print to console": { | |
"prefix": "log", | |
"body": [ |
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
# om namah shivay | |
steps: | |
# decrypt root/secrets/cloud-datastore.json | |
- name: gcr.io/cloud-builders/gcloud | |
args: | |
- kms | |
- decrypt | |
- --location=global |
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
// om namah shivay | |
const mongoose = require('mongoose'); | |
const mobile = { | |
country_code: String, | |
number: String | |
}; | |
module.exports = { |
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
// om namah shivay | |
const mongoose = require('mongoose'); | |
const common = require('./common'); | |
const user_schema = new mongoose.Schema({ | |
_id: mongoose.Schema.ObjectId, | |
first_name: String, | |
last_name: String, | |
mobile: common.mobile, |
OlderNewer