Skip to content

Instantly share code, notes, and snippets.

View osumgbachiamaka's full-sized avatar

Osumgba Chiamaka osumgbachiamaka

View GitHub Profile
@osumgbachiamaka
osumgbachiamaka / RemoveExpiredCampaigns.js
Created August 14, 2020 04:57
RemoveExpiredCampaigns removes campaigns with expired dates from a list of ongoing campaigns.
// sample social media campaigns and their expiry dates
const campaigns =
[
{
"type": "campaign",
"target": "Facebook",
"expiry": "2020-03-07T16:32:12.011Z",
"id": "campaign:05:target:facebook:campaignNo:4AB12"
},
@osumgbachiamaka
osumgbachiamaka / Google Sheet API Authentication Class Module
Created August 2, 2020 04:13
A Class Module to authenticate and authorise the use of the Google Sheet API
const fs = require('fs');
const readline = require('readline');
const {google} = require('googleapis');
// If modifying these scopes, delete token.json.
// SCOPE gives additional rules to the sheet, you can restrict rule to readonly or give full access
const SCOPES = ['https://www.googleapis.com/auth/spreadsheets'];
// The file token.json stores the user's access and refresh tokens, and is
// created automatically when the authorization flow completes for the first
// time.