Skip to content

Instantly share code, notes, and snippets.

Luis G. Valle lgvalle

Block or report user

Report or block lgvalle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lgvalle / firebase-scraping.js
Last active Aug 30, 2019
Firebase cloud function to scrap html and send the content with push notifications
View firebase-scraping.js
const rp = require('request-promise');
const cheerio = require('cheerio');
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const db = admin.firestore();
exports.allyPallyFarmersMarket = functions.https.onRequest((request, response) => {
View gist:d03f594c85db23b432ff9ab173f10e24
docker run -v $PWD:/usr/app -w /usr/app -p 9005:9005 -u node -it lgvalle/firebasetools:v2 sh
lgvalle / Docker shell
Created Mar 31, 2018 — forked from bahmutov/Docker shell
A personal cheat sheet for running local Node project in a Docker container
View Docker shell
# See list of docker virtual machines on the local box
$ docker-machine ls
default * virtualbox Running tcp:// v1.9.1
# Note the host URL - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
View docker-compose.yml
version: '3'
image: rethinkdb:2.3
- "8080:8080"
- "28015:28015"
- "29015:29015"
restart: always
lgvalle / index.js
Created Sep 10, 2017
Blogpost Firebase II - Full code
View index.js
const ONE_HOUR = 3600000
var functions = require('firebase-functions');
var Client = require('node-rest-client').Client;
var client = new Client();
const admin = require('firebase-admin');
View full_code.js
const functions = require('firebase-functions')
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)
View step4.js
function cleanUp(data) {
// Empty array to add cleaned up elements to
const items = []
// We are only interested in children of the 'channel' element
const channel =
channel.item.forEach(element => {
item = {
title: element.title,
description: element.description,
View tidy_up_response.json
"title": "'Leaving London means I can afford kids': readers on why the capital lost its sparkle",
"description": "Almost 100,000 Londoners moved out last year. Here they, and others who are avoiding the city altogether, explain why it is no longer the place to be<br></p><p>The rate of Londoners leaving the capital is more than <a href="">80% higher than five years ago</a>, according to Savills, with people in their thirties the age group most likely to leave. </p><p>We asked readers why they’re leaving London, or avoiding moving to the capital altogether. Here’s what you said:</p><p>All my salary was being spent on living costs in London</p> <a href="">Continue reading...</a>",
"date": "Mon, 31 Jul 2
View raw_response.xml
<rss xmlns:media=”" xmlns:dc=”" version=”2.0">
 <title>London | The Guardian</title>
 <description>Latest news and features from, the world’s leading liberal voice</description>
 <copyright>Guardian News and Media Limited or its affiliated companies. All rights reserved. 2017</copyright>
 <pubDate>Mon, 31 Jul 2017 15:32:49 GMT</pubDate>
lgvalle / step2.js
Last active Aug 8, 2017
Post: Take control of your backend (II)
View step2.js
const Client = require('node - rest - client').Client
const client = new Client()
exports.fetch = functions.https.onRequest((req, res) => {
client.get(BACKEND_URL, function (data, response) {
(…) // TODO Clean up
return res.status(200)
.type('application / json')
You can’t perform that action at this time.