Skip to content

Instantly share code, notes, and snippets.

View LindaLawton's full-sized avatar
🎯
Focusing

Linda Lawton LindaLawton

🎯
Focusing
View GitHub Profile
@LindaLawton
LindaLawton / GoogleDriveV2PageStreamer
Created May 19, 2016 13:33
Example of using PageStreamer on Files.list with Google Drive v2
var pageStreamer = new PageStreamer<Google.Apis.Drive.v2.Data.File, FilesResource.ListRequest, FileList, string>(
(request, token) => request.PageToken = token,
response => response.NextPageToken,
response => response.Items);
var req = service.Files.List();
req.MaxResults = 1000;
foreach (var result in pageStreamer.Fetch(req))
{
@LindaLawton
LindaLawton / GoogleDriveV3PageStreamer
Created May 24, 2016 11:50
Example of using PageStreamer on Files.list with Google Drive v3
var pageStreamer = new PageStreamer<Google.Apis.Drive.v3.Data.File, FilesResource.ListRequest, Google.Apis.Drive.v3.Data.FileList, string>(
(request, token) => request.PageToken = token,
response => response.NextPageToken,
response => response.Files);
var req = service.Files.List();
req.PageSize = 1000;
foreach (var result in pageStreamer.Fetch(req))
{
@LindaLawton
LindaLawton / Google Contacts V3 for c#
Created May 26, 2016 11:14
How to merge the Google APIs Client library with the Gdata client library to access Google Contacts using C#
using Google.Apis.Auth.OAuth2;
using Google.Apis.Util.Store;
using Google.GData.Client;
using Google.GData.Contacts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@LindaLawton
LindaLawton / Particle Photon photoresistor to Google Analytics
Last active June 14, 2016 19:24
sending hits to Google Analytics
// This #include statement was automatically added by the Particle IDE.
#include "HttpClient/HttpClient.h"
/**
* Declaring the variables.
*/
unsigned int nextTime = 0; // Next time to contact the server
HttpClient http;
// Headers currently need to be set at init, useful for API keys etc.
@LindaLawton
LindaLawton / Google Analytics particle event webhook
Last active June 26, 2016 14:03
Webhook to send event data to Google Analytics
{
"event": "AnalyticsEvent",
"url": "https://www.google-analytics.com/collect",
"requestType": "POST",
"query":
{
"v": "1",
"t": "event",
"tid" : "{{tid}}",
"cd": "{{cd}}",
@LindaLawton
LindaLawton / Google Analytics particle event publish
Created June 26, 2016 14:42
sends event to Google Analytics event webhook
/*
* Declaring the variables.
*/
char MyIp[16] ;
char AccountId[20] = "UA-xxxx-1";
char cid[10] = "123";
void setup() {
Serial.begin(9600);
}
{
"event": "ScreenViewHit",
"url": "https://www.google-analytics.com/collect",
"requestType": "POST",
"query":
{
"v": "1",
"t": "{{t}}",
"tid" : "{{tid}}",
"cd": "{{cd}}",
/*
* Declaring the variables.
*/
char MyIp[16] ;
char AccountId[20] = "UA-XXX-1";
char cid[10] = "123";
void setup() {
Serial.begin(9600);
}
@LindaLawton
LindaLawton / Wix Toolset Upgrade
Created July 6, 2016 13:24
How to allow upgrade with Wix.
<?xml version="1.0" encoding="UTF-8"?>
<?define ProductVersion="!(bind.FileVersion.MyAssemblyDll)"?>
<?define UpgradeCode="f4d7f199-28f6-45d5-ad99-7c62938274be"?>
<?define ProductId="{6408D956-40DA-4AEE-883E-5425F1562004}"?>
<?define Version="1.0.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="UpgradeTest" Language="1033" Version="$(var.Version)" Manufacturer="xxx" UpgradeCode="$(var.UpgradeCode)">
<Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
@LindaLawton
LindaLawton / Google Service Account
Last active March 26, 2023 12:00
Example of using Google Service accounts p12, Json and key. For the Google .net client library
using Google.Apis.AnalyticsReporting.v4;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
using System;
using System.IO;
using System.Security.Cryptography.X509Certificates;
namespace GoogleAnaltyics.V4
{
public class ServiceAccountJson