Skip to content

Instantly share code, notes, and snippets.

View silvolu's full-sized avatar

Silvano Luciani silvolu

View GitHub Profile
@silvolu
silvolu / gist:3296667
Created August 8, 2012 17:01
Shows how to check the visibility of a Hangout App and of the Hangout Chat Pane and show notification to the users in response to changes.
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<!-- Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
@silvolu
silvolu / gist:5062716
Last active December 14, 2015 09:09
Write moments after authentication with gapi.auth.authorize().
<html>
<head>
<script src="https://apis.google.com/js/client.js"></script>
<script>
function auth() {
var config = {
'client_id': 'YOUR_CLIENT_ID',
'scope': 'https://www.googleapis.com/auth/plus.login',
'request_visible_actions': 'http://schemas.google.com/AddActivity'
};
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
(function() {
var po = document.createElement('script');
po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
@silvolu
silvolu / index.php
Last active June 30, 2016 10:25
Write moments with the trunk version of the Google APIs Client Library for PHP https://code.google.com/p/google-api-php-client/source/checkout
<?php
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_PlusService.php';
// Set your cached access token. Remember to replace $_SESSION with a
// real database or memcached.
session_start();
$client = new Google_Client();
$client->setApplicationName('Google+ PHP Starter Application');
@silvolu
silvolu / prosody.xml
Created December 6, 2017 18:42
Example of SSML <prosody>.
<speak>
Hello
<break/>
With SSML,
<prosody rate="fast">you can make speech fast.</prosody>
<prosody rate="slow">Or, make it slow.</prosody>
<prosody pitch="high">You can make it high.</prosody>
<prosody pitch="low">Or, you can make it low.</prosody>
<prosody volume="loud">You can make it loud.</prosody>
<prosody volume="soft">Or, you can make it quiet.</prosody>
@silvolu
silvolu / say-as.xml
Created December 6, 2017 19:20
Examples of <say-as> format attributes.
<speak>
<say-as interpret-as="spell-out">silvano</say-as> is how you spell out my name.
I am <say-as interpret-as="unit"> 1 .75 m </say-as> tall.
<say-as interpret-as="fraction">5+1/2</say-as> is a fraction.
<say-as interpret-as="expletive">censored</say-as> is something that I shouldn't be saying.
</speak>
@silvolu
silvolu / media-example.xml
Created December 6, 2017 19:24
First example of SSML media element.
<speak>
<par>
<media xml:id="question" begin="0.5s">
<speak>Who invented the Internet?</speak>
</media>
<media xml:id="answer" begin="question.end+2.0s">
<speak>The Internet was invented by cats.</speak>
</media>
<media begin="answer.end-0.2s" soundLevel="-6db">
<audio
@silvolu
silvolu / v2-conv.js
Created March 13, 2018 21:19
The new Conversation abstraction
const app = dialogflow({ debug: true })
app.intent('Default Welcome Intent', conv => {
conv.ask('Hi')
})
@silvolu
silvolu / v2-no-builders.js
Created March 13, 2018 21:24
Comparison between creating a BasicCard in v1 and in v2
// v1
app.buildRichResponse(
app.buildBasicCard('some string')
.setImage('https://site.com/img.png', 'some other string'))
// v2
conv.ask(new BasicCard({
title: 'some string',
image: {
url: 'https://site.com/img.png',
@silvolu
silvolu / v2-plugins.js
Last active March 16, 2018 16:10
Using plugins with Actions on Google client library v2
const { dialogflow } = require('actions-on-google')
const { randomize, Randomization } = require('randomize')
const app = dialogflow()
.use(randomize)
app.intent('tell.greeting', conv => {
conv.ask(`The last thing I told you was ${conv.randomize.last}`)
conv.ask(new Randomization(
'How are you?',