This file contains 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
/** | |
* @OnlyCurrentDoc | |
*/ | |
function doGet(e) { | |
var myparams = e.queryString | |
var peticiones = SpreadsheetApp.getActive().getSheetByName("Peticiones"); | |
peticiones.appendRow([myparams, Session.getActiveUser().getEmail(), new Date()]) | |
return HtmlService.createHtmlOutput('<b>Petición Registrada </b>'); | |
} |
This file contains 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
'use strict'; | |
const functions = require('firebase-functions'); | |
const {google} = require('googleapis'); | |
const {WebhookClient} = require('dialogflow-fulfillment'); | |
//id of the calendar to insert events | |
const calendarId = "g8gas0qsadfasdasdfasdfaj9hqt0@group.calendar.google.com"; | |
//Paste here the content of key.json | |
const serviceAccount = { | |
"type": "service_account" |
This file contains 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
//based on https://stackoverflow.com/questions/43622127/filtering-table-multiple-columns | |
//<input type="text" id="myInput" onkeyup="searchFunction()" placeholder="Buscar.." title="Type in a name"> | |
function filterTable(event) { | |
var filter = event.target.value.toUpperCase(); | |
var rows = document.querySelector("#myTable").rows; | |
for (var i = 0; i < rows.length; i++) { | |
var firstCol = rows[i].cells[0].textContent.toUpperCase(); | |
var secondCol = rows[i].cells[1].textContent.toUpperCase(); | |
if (rows[i].textContent.toUpperCase().indexOf(filter) > -1) { |
This file contains 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
//gcloud beta functions deploy screenshot --trigger-http --runtime nodejs8 | |
const puppeteer = require('puppeteer'); | |
let page; | |
async function getBrowserPage() { | |
// Launch headless Chrome. Turn off sandbox so Chrome can run under root. | |
const browser = await puppeteer.launch({args: ['--no-sandbox']}); | |
return browser.newPage(); | |
} |
This file contains 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
//gcloud functions deploy visionapp --runtime nodejs6 --trigger-http --project projectname | |
'use strict'; | |
var express = require('express'); | |
var fs = require('fs'); | |
var util = require('util'); | |
var mime = require('mime-types') | |
const path = require('path'); | |
const os = require('os'); | |
// Node.js doesn't have a built-in multipart/form-data parsing library. |
This file contains 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
//gcloud functions deploy imgmoderator --runtime nodejs6 --trigger-resource gs://mybuckettomoderate --trigger-event google.storage.object.finalize --project myproject | |
const vision = require('@google-cloud/vision'); | |
const {Storage} = require('@google-cloud/storage'); | |
const client = new vision.ImageAnnotatorClient(); | |
const gcs = new Storage(); | |
exports.imgmoderator = function (event, callback) { | |
const object = event.data; | |
const bucket = gcs.bucket(object.bucket); | |
if (object.resourceState === 'not_exists') {return console.log('This is a deletion event.');} | |
client.safeSearchDetection(`gs://${object.bucket}/${object.name}`).then(results => { |
This file contains 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
# To install the Stackdriver monitoring agent: | |
$ curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh | |
$ sudo bash install-monitoring-agent.sh | |
# To install the Stackdriver logging agent: | |
$ curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh | |
$ sudo bash install-logging-agent.sh |
This file contains 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
//export GOOGLE_APPLICATION_CREDENTIALS =./serviceaccount.json | |
//npm i --save @google-cloud/storage | |
//node index.js | |
var storage = require('@google-cloud/storage')(); | |
var bucket = storage.bucket('mybucket'); | |
var fs = require('fs'); | |
//Download of a file | |
//var remoteFile = bucket.file('intdb'); | |
//var localFilename = './files/intdb'; |
This file contains 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
//export GOOGLE_APPLICATION_CREDENTIALS =./serviceaccount.json | |
//npm i --save @google-cloud/storage | |
//node index.js | |
var storage = require('@google-cloud/storage')(); | |
var bucket = storage.bucket('nameofbucket'); | |
var fs = require('fs'); | |
var remoteFile = bucket.file('mi_file.txt'); | |
var localFilename = '/filepath/mi_file.txt'; |