Skip to content

Instantly share code, notes, and snippets.

@lgvalle
lgvalle / Docker shell commands.sh
Created March 31, 2018 12:45 — forked from bahmutov/Docker shell commands.sh
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
@lgvalle
lgvalle / gist:d03f594c85db23b432ff9ab173f10e24
Created March 31, 2018 15:03
Run firebase tools docker image
docker run -v $PWD:/usr/app -w /usr/app -p 9005:9005 -u node -it lgvalle/firebasetools:v2 sh
@lgvalle
lgvalle / index.js
Created September 10, 2017 18:38
Blogpost Firebase II - Full code
const ONE_HOUR = 3600000
var functions = require('firebase-functions');
const URL_THE_GUARDIAN = "https://www.theguardian.com/uk/london/rss"
var Client = require('node-rest-client').Client;
var client = new Client();
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
@lgvalle
lgvalle / firebase-scraping.js
Last active September 23, 2021 01:17
Firebase cloud function to scrap html and send the content with push notifications
const rp = require('request-promise');
const cheerio = require('cheerio');
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
const db = admin.firestore();
exports.allyPallyFarmersMarket = functions.https.onRequest((request, response) => {
const functions = require('firebase-functions')
const URL_THE_GUARDIAN = "https://www.theguardian.com/uk/london/rss"
const Client = require('node-rest-client').Client
const client = new Client()
exports.fetch = functions.https.onRequest((req, res) => {
client.get(URL_THE_GUARDIAN, function (data, response) {
const items = cleanUp(data)
res.status(201)