Skip to content

Instantly share code, notes, and snippets.

View anton-dudarev's full-sized avatar
🎯
Focusing

Anoubis anton-dudarev

🎯
Focusing
View GitHub Profile
@anton-dudarev
anton-dudarev / DatabaseFromSpreadsheet.js
Created January 4, 2019 18:17 — forked from brainysmurf/DatabaseFromSpreadsheet.js
In AppMaker, use this to read in data from a Spreadsheet.
/**
* DataFromSpreadsheet: Read in Spreadsheet info for a Calculated Datasource in AppMaker. Use a spreadsheet to define a datasource.
* Useful for data modeling, simple Apps.
* Does not support paging; sheets with large number of rows will see performance penalties
* @param {object} params
* @param {string} params.spreadsheetId The ID of the source spreadsheet
* @param {string} params.sheetName The name of the source sheet
* @param {string} params.datasource The name of the target datasource
* @param {number} params.numHeaders How many rows are headers (default = 1)
* @param {number} params.headerRow Which row contains the name of the field (default=params.numHeaders-1)
@anton-dudarev
anton-dudarev / appsscriptzoneids.csv
Created May 2, 2019 08:21 — forked from mhawksey/appsscriptzoneids.csv
ZoneIds used in Google Apps Script
value text
Pacific/Midway (GMT-11:00) Midway
Pacific/Niue (GMT-11:00) Niue
Pacific/Pago_Pago (GMT-11:00) Pago Pago
Pacific/Honolulu (GMT-10:00) Hawaii Time
Pacific/Johnston (GMT-10:00) Johnston
Pacific/Rarotonga (GMT-10:00) Rarotonga
Pacific/Tahiti (GMT-10:00) Tahiti
Pacific/Marquesas (GMT-09:30) Marquesas
America/Anchorage (GMT-09:00) Alaska Time
# Converts a JSONL file generated with telegram-history-dump (1) to CSV
# Usage: python telegram-csv.py <path to json file> <path to output csv file>
# Example: python telegram-csv.py Bob.json Bob.csv
# 1: https://github.com/tvdstaaij/telegram-history-dump
from datetime import datetime
import unicodecsv as csv
import json, sys
def get_isodate(msg):
date = msg.get("date", None)
'use strict';
const admin = require('firebase-admin');
admin.initializeApp();
const functions = require('firebase-functions'); // Cloud Functions for Firebase library
const DialogflowApp = require('actions-on-google').DialogflowApp; // Google Assistant helper library
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
if (request.body.queryResult) {
@anton-dudarev
anton-dudarev / Buttons_Template.js
Created May 25, 2019 22:02 — forked from Anshul0305/Buttons_Template.js
Facebook Code Snippets
{
"facebook":{
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text":"What do you want to do next?",
"buttons":[
{
"type":"web_url",
@anton-dudarev
anton-dudarev / index.js
Created May 25, 2019 22:09 — forked from naranjja/index.js
Google Analytics tracking using Dialogflow API v2 and some REST API
const ua = require("universal-analytics");
const request = require("request-promise");
const { https } = require("firebase-functions");
function getUserID (obj) {
if (!obj.source) {
return "dialogflow";
} else {
switch (obj.source) {
case "twilio":
@anton-dudarev
anton-dudarev / dlf-detect-intent.js
Created May 25, 2019 22:11 — forked from nvtuan305/dlf-detect-intent.js
Detect Dialogflow intent that supports multiple agents using API v2
'use strict';
// @ts-ignore
const dialogflow = require('dialogflow');
const fs = require('fs');
/**
* Detect dialogflow intent
* @param {String} botId
* @param {String} sessionId
@anton-dudarev
anton-dudarev / dialogflowResponses.js
Created May 25, 2019 22:11 — forked from balsimpson/dialogflowResponses.js
Dialogflow responses for FB Messenger integration.
const Dialogflow = {
fulfillmentMessages: [],
text: function (txt) {
// console.log(typeof txt);
if (typeof txt === 'string') {
txt = `${txt}`
} else {
txt = `${txt.title}\n\n${txt.upvotes} upvotes | ${txt.comments} comments\n\n`
@anton-dudarev
anton-dudarev / getInfo.js
Created May 25, 2019 22:18 — forked from tbass134/getInfo.js
Dialogflow webhook to transfer user to live agent
function getInfo(contexts) {
var product = contexts[contexts.length - 1]['parameters']['Product']
var state = contexts[contexts.length - 1]['parameters']['geo-state-us']
for (var i = 0; i < contexts.length; i++) {
var context = contexts[i]['parameters']
if (typeof context['Product'] != "undefined" && typeof context['geo-state-us'] != "undefined") {
return context
}