Skip to content

Instantly share code, notes, and snippets.

@evilUrge
evilUrge / firebase-deploy.js
Created May 2, 2019
Deploy to firebase with any CI
View firebase-deploy.js
const fs = require('fs');
const token = process.env['FIREBASE_TOKEN']; // Keep your firebase cli token in FIREBASE_TOKEN as a env param
const projectName = (JSON.parse(fs.readFileSync(`${__dirname}/.firebaserc`, 'utf8')))
.projects[process.env.NODE_ENV ? process.env.NODE_ENV : 'default'];
/**
* FireBase Deployment script
* FOR CI USE ONLY!
*/
@evilUrge
evilUrge / fetch.js
Last active May 2, 2019
Fetch configurations from Firestore's collection "configurations" as json files.
View fetch.js
process.env.NODE_ENV = process.env.NODE_ENV ? process.env.NODE_ENV : 'development';
require('../src/firebase').admin.firestore().collection('configurations').get()
.then(documents =>
documents.forEach((document) =>
require('fs').writeFile(`${require('../src/utils').baseDir}/config/${document.id}.json`, JSON.stringify(document.data()), (error) =>
error ? console.error(error) : console.log(`Configuration file ${document.id}.json has been created!`))));
@evilUrge
evilUrge / server.js
Last active May 6, 2019
Express.js\restify auto register handlers by path
View server.js
module.exports = (() => {
/**
* Map all available handlers to express route.
* @type {{handler}|*}
*/
const fs = require('fs');
const express = require('express');
const bodyParser = require('body-parser');
const bunyan = require('bunyan');
@evilUrge
evilUrge / express_server_obj_exposed_to_firebase.js
Last active May 13, 2019
Firebase function serving restify server if production(else just start server onj)
View express_server_obj_exposed_to_firebase.js
const server = require(`./src/server`);
process.env.NODE_ENV === "DEV" ?
/**
* If dev environment, run express server for local debugging.
*/
server.listen(process.env.PORT || 3000) :
/**
* Creates a function instance and with a specific specs.
@evilUrge
evilUrge / docker-compose.yml
Created Mar 15, 2018 — forked from KrustyHack/docker-compose.yml
Docker-compose for rancher, nginx and let's encrypt
View docker-compose.yml
nginx-proxy:
image: jwilder/nginx-proxy:latest
ports:
- "80:80"
- "443:443"
volumes:
- '/home/docker/nginx-proxy/ssl:/etc/nginx/certs:ro'
- '/etc/nginx/vhost.d'
- '/usr/share/nginx/html'
- '/var/run/docker.sock:/tmp/docker.sock:ro'
View gist:488c65e1822c9e2c2ad8c75fcb24b746
### Keybase proof
I hereby claim:
* I am evilurge on github.
* I am evilurge (https://keybase.io/evilurge) on keybase.
* I have a public key ASDtn_MWVDpdsa6Did8RWtLKYNqkG3GFXSfaB-OGON0Idwo
To claim this, I am signing this object:
You can’t perform that action at this time.