Skip to content

Instantly share code, notes, and snippets.

View lgs's full-sized avatar

Luca G. Soave lgs

View GitHub Profile
@codediodeio
codediodeio / index.js
Created July 10, 2017 16:03
Simple Stripe Payments with Firebase Cloud Functions
const functions = require('firebase-functions')
const admin = require('firebase-admin')
admin.initializeApp(functions.config().firebase);
const stripe = require('stripe')(functions.config().stripe.testkey)
exports.stripeCharge = functions.database
@codediodeio
codediodeio / index.js
Last active January 23, 2021 17:06
Transactional Email Firebase Cloud Function with Sendgrid
var functions = require('firebase-functions');
const sendgrid = require('sendgrid')
const client = sendgrid("YOUR_SG_API_KEY")
function parseBody(body) {
var helper = sendgrid.mail;
var fromEmail = new helper.Email(body.from);
var toEmail = new helper.Email(body.to);
var subject = body.subject;
@sararob
sararob / cloud-nlp.js
Created April 19, 2017 15:20
Call the Cloud Natural Language API from Node.js
'use strict';
const fs = require('fs');
const ndjson = require('ndjson');
const request = require('request');
fs.createReadStream('reddit-comments.json') // Newline delimited JSON file
.pipe(ndjson.parse())
.on('data', function(obj) {
@savelee
savelee / bigQuery.js
Created March 10, 2017 13:42
bigQuery.js
//require the google-cloud npm package
//setup the API keyfile, so your local environment can
//talk to the Google Cloud Platform
const gcloud = require('google-cloud')({
projectId: process.env.GCLOUD_PROJECT,
keyFilename: process.env.GCLOUD_KEY_FILE
});
//We will make use of the bigquery() API
const bq = gcloud.bigquery();
@stursby
stursby / README.md
Last active September 8, 2024 11:22
Vue + Firebase + Auth Demo

Vue + Firebase + Auth Demo

A simple App using Vue.js & Firebase with Auth.

See the DEMO.

let axios = require('axios'); // HTTP client
let cheerio = require('cheerio'); // HTML parsing package
let jsonframe = require('jsonframe-cheerio'); // a cheerio plugin I designed
let fs = require('fs'); // is included in node.js - you don't need to install it
axios.get('https://www.producthunt.com')
.then((response) => {
if(response.status === 200) {
git clone https://github.com/vfarcic/go-demo.git
cd go-demo
docker-machine create -d virtualbox go-demo
docker-machine env go-demo
eval $(docker-machine env go-demo)
@alexei-led
alexei-led / create_swarm_cluster.sh
Last active April 15, 2024 20:45
Deploy Docker Compose (v3) to Swarm (mode) Cluster
#!/bin/bash
# vars
[ -z "$NUM_WORKERS" ] && NUM_WORKERS=3
# init swarm (need for service command); if not created
docker node ls 2> /dev/null | grep "Leader"
if [ $? -ne 0 ]; then
docker swarm init > /dev/null 2>&1
fi
@justjanne
justjanne / Price Breakdown.md
Last active April 5, 2025 08:10 — forked from kylemanna/price.txt
Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:

Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:

Permalink: git.io/vps

$5/mo

Provider Type RAM Cores Storage Transfer Network Price
# --------------------------------------------------------------
# script to create a new Docker Swarm from scratch on VirtualBox
# --------------------------------------------------------------
#!/usr/bin/bash
NUM_NODES=5
LEADER_NODE=node-1
# clean up
for NODE in $(seq 1 $NUM_NODES); do