Skip to content

Instantly share code, notes, and snippets.

Avatar
😼
Cat face with wry smile

Alex Ivanov contributorpw

😼
Cat face with wry smile
View GitHub Profile
@contributorpw
contributorpw / index.html
Last active Jan 19, 2017
The simple file demonstrates #google_js_client_api #gapi
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TEST</title>
<script type="text/javascript" src="./js.js"></script>
<script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
</head>
<body>
@contributorpw
contributorpw / js.js
Last active Aug 29, 2015
Set permissions for a file #gapi #snippet
View js.js
var setAccess = function setAccessF() {
gapi.client.request({
path : '/drive/v2/files/fileID/permissions',
method : 'post',
body : {
'value' : 'anyone',
'type' : 'anyone',
'role' : 'reader'
}
}).then(opt_onFulfilled, opt_onRejected);
@contributorpw
contributorpw / js.js
Created May 19, 2015
Lists all labels in the user's mailbox #gapi #snippet #gmail
View js.js
function getListLabels() {
gapi.client.request({
path : '/gmail/v1/users/me/labels',
method : 'get'
}).then(opt_onFulfilled, opt_onRejected);
}
function opt_onRejected(e) {
console.log(e);
}
@contributorpw
contributorpw / js.js
Created May 20, 2015
Sends the specified message to the recipients in the To, Cc, and Bcc headers. #gapi #snippet #gmail [not /upload]
View js.js
function sendMail() {
var email = [
'From: John Doe <jdoe@machine.example> ',
'To: Mary Smith <mary@example.net> ',
'Subject: Saying Hello ',
'Date: Fri, 21 Nov 1997 09:55:06 -0600 ',
'Message-ID: <1234@local.machine.example>',
'',
'This is a message just to say hello. So, "Hello".'
].join('\r\n');
@contributorpw
contributorpw / hello-world.html
Last active Aug 29, 2015
Binding to properties two-way two-way binding #polymer #0.9 #binding
View hello-world.html
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/iron-input/iron-input.html">
<dom-module id="hello-world">
<template>
<h1>Hello <span>{{name}}</span></h1>
<!-- first way -->
<input is="iron-input" bind-value="{{name}}" placeholder="Your name here..."><br/>
<!-- second way -->
<input value="{{name::keyup}}">
@contributorpw
contributorpw / Code.gs
Last active Aug 29, 2015
YAMMPreparation prepares the line to send mail via YAMM (Yet Another Mail Merge) #gas
View Code.gs
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('YAMM Preparation')
.addItem('Preparation', 'preparation')
.addItem('Set folder of Details', 'setFolderOfDetails')
.addToUi();
}
function preparation(){
try{
@contributorpw
contributorpw / 8db2131bf7357247bc2b.md
Last active Oct 7, 2018
Create a Gmail draft via Google Apps Script #gas #gmail
View 8db2131bf7357247bc2b.md
@contributorpw
contributorpw / js.js
Created May 27, 2015
Lists sessions previously created #gapi #fit
View js.js
function getFitActivity(pageToken) {
var params = {};
if(pageToken) params.pageToken = pageToken;
params.startTime = '2014-12-18T00:00:00.00Z';
params.endTime = '2014-12-18T17:34:00.00Z';
var request = gapi.client.request({
'path' : '/fitness/v1/users/me/sessions',
'method' : 'GET',
'params' : params
}).then(opt_onFulfilled, opt_onRejected);
@contributorpw
contributorpw / 7bccede9e74bc1f8025e.md
Last active Aug 29, 2015
Retrieve a Site for the given Google Site #gas #googlesites
View 7bccede9e74bc1f8025e.md