Skip to content

Instantly share code, notes, and snippets.

View wilcoschoneveld's full-sized avatar

Wilco Schoneveld wilcoschoneveld

View GitHub Profile
diff --git a/node_modules/cypress-image-snapshot/plugin.js b/node_modules/cypress-image-snapshot/plugin.js
index 106d726..4ca37b5 100644
--- a/node_modules/cypress-image-snapshot/plugin.js
+++ b/node_modules/cypress-image-snapshot/plugin.js
@@ -96,7 +96,9 @@ function matchImageSnapshotPlugin({ path: screenshotPath }) {
// remove the cypress v5+ native retries suffix from the file name
const snapshotIdentifier = name.replace(/ \(attempt [0-9]+\)/, '');
- const relativePath = _path2.default.relative(screenshotsFolder, screenshotDir);
+ // always write snapshot images to root snapshots directory
import { google } from 'googleapis';
import { Injectable, HttpService } from '@nestjs/common';
import { InjectSchedule, Schedule } from 'nest-schedule';
import { LoggerService } from '../logger/logger.service';
interface GoogleCalendarEvent {
id: string;
summary: string;
description: string;
// ...
async processEvent(event: GoogleCalendarEvent) {
// Test event for a summary in the format of '[#channel] ...'
const regex = /^\[(#[a-z0-9-_]+)\]/;
const elements = regex.exec(event.summary);
// This event does not match format (could have been processed before)
if (elements === null) {
return;
}
interface GoogleCalendarEvent {
id: string;
summary: string;
description: string;
}
async pollCalendarEvents() {
// Define a range of twice the polling interval (in case of polling delays)
const timeNow = new Date();
const timeMin = new Date(timeNow.getTime() - this.POLLING_INTERVAL * 2);
// Create a new GoogleAuth instance with service-account credentials from a json file.
// Note: credential file location must be set in GOOGLE_APPLICATION_CREDENTIALS env variable
const auth = new google.auth.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/calendar'],
clientOptions: {
// Overwrite JWT subject to 'impersonate' calendar user
subject: 'wilco@headfwd.com'
}
});
// Create a new GoogleAuth instance with service-account credentials from a json file.
// Note: credential file location must be set in GOOGLE_APPLICATION_CREDENTIALS env variable
const auth = new google.auth.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/calendar'],
clientOptions: {
// Overwrite JWT subject to 'impersonate' calendar user
subject: 'wilco@headfwd.com'
}
});
@wilcoschoneveld
wilcoschoneveld / machine.js
Last active September 20, 2019 17:18
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions