View .js
'use strict';
process.env.DEBUG = 'actions-on-google:*';
const request = require('request');
const Assistant = require('actions-on-google').ApiAiAssistant;
var CHANNELS = new Map([
["Nederland 1", 1],
["Nederland 2", 2],
View videointelligence.js
/**
{
kind: 'storage#object',
resourceState: 'exists',
id: 'leeboonstra-videoapi/mov_bbb.mp4/1490796080783211',
selfLink: 'https://www.googleapis.com/storage/v1/b/leeboonstra-videoapi/o/mov_bbb.mp4',
name: 'mov_bbb.mp4',
bucket: 'leeboonstra-videoapi',
generation: '1490796080783211',
metageneration: '1',
View howto.md

Windows

Windows 10 and Windows 8

  • In Search, search for and then select: System (Control Panel)
  • Click the Advanced system settings link.
  • Click Environment Variables.
  • In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
  • In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
View 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();
View twitter2.js
var express = require('express'),
router = express.Router(),
Stream = require('user-stream');
var path = require('path');
var machinelearning = require( path.resolve( __dirname, "ml.js" ) );
//var bigquery = require( path.resolve( __dirname, "bigQuery.js" ) );//added in a later step
//setup the twitter stream API, and provide your consumer and access tokens
View ml.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 language() and translate()
//GCP machine learning APIs
View twitter.js
var express = require('express'),
router = express.Router(),
Stream = require('user-stream');
//Setup the twitter stream API, and provide your consumer and access tokens
const stream = new Stream({
consumer_key: process.env.CONSUMER_KEY,
consumer_secret: process.env.CONSUMER_SECRET,
access_token_key: process.env.ACCESS_TOKEN_KEY,
access_token_secret: process.env.ACCESS_TOKEN_SECRET
View UDF.sql
#standardSQL
CREATE TEMPORARY FUNCTION lab_TIME(x ARRAY<TIMESTAMP>)
RETURNS INT64
LANGUAGE js AS """
var total_time = 0;
//loop through
for (var i = 0; i < x.length -1; i+=2)
{ total_time += x[i+1] - x[i]; }
return total_time/1000;
""";
View Window.sql
#standardSQL
SELECT
corpus,
word,
word_count,
RANK() OVER (PARTITION BY corpus ORDER BY word_count DESC) rank
FROM
`publicdata.samples.shakespeare`
WHERE
LENGTH(word) > 10
View Regex.sql
#standardSQL
SELECT
word,
COUNT(word) AS count
FROM
`publicdata.samples.shakespeare`
WHERE
(REGEXP_CONTAINS(word,
r'^\w\w\'\w\w'))
GROUP BY