Skip to content

Instantly share code, notes, and snippets.

View nelsonni's full-sized avatar
🤓
Researching

Nicholas Nelson nelsonni

🤓
Researching
View GitHub Profile
@zoidy
zoidy / autoDeleteGmail.js
Last active April 13, 2024 14:24 — forked from jordanlambrecht/autoDeleteGmail.js
Auto Delete / Archive Emails in Gmail
/*
Original Sources:
- https://pixelbakery.com/recipes/gmail-automatically-delete-or-archive-emails
- https://benbjurstrom.com/purge-email
v1.1
https://gist.github.com/zoidy
Auto-archive and delete Gmail messages based on a defined retention period. Functionality:
- Uses Gmail labels to apply retention rules (archive or delete)
@jordanlambrecht
jordanlambrecht / autoDeleteGmail.js
Last active April 24, 2024 23:52
Auto Delete / Archive Emails in Gmail
function autoDelete() {
console.log('Started autoDelete run.');
var delayDays = 2;
var maxDate = new Date();
maxDate.setDate(maxDate.getDate()-delayDays);
var label = GmailApp.getUserLabelByName("delete me");
var threads = label.getThreads();
if(threads.length > 0){
console.log('Found ' + threads.length + ' emails marked for deletion.');
@JLarky
JLarky / action.ts
Last active December 17, 2019 16:31
type safe redux actions (typescript)
// like typesafe-actions
export type AnyAction<T extends string, A> = A & {
type: T;
};
export function createAction<T extends string, P, AC extends (...args: any[]) => AnyAction<T, P>>(
type: T,
map: AC
): AC & { type: T } {