Skip to content

Instantly share code, notes, and snippets.

@sndurkin
sndurkin / Outlook calendar import & export.js
Last active September 20, 2024 20:23
Code for importing & exporting calendar events from Outlook web, for when sharing calendars is not possible
/**
* This code supports importing & exporting calendar events from Outlook web by interacting with the
* DOM elements to read data and create events.
*
* The 2 main entry points are:
*
* exportCalendarEvents() - This will copy all calendar events in the current view (e.g. week) and copy them as JSON to the clipboard.
* importCalendarEvents() - This will read the calendar events JSON from the clipboard and import them into the current calendar.
*
* Suggested usage:
@sndurkin
sndurkin / splitBySearchQuery
Last active May 2, 2019 17:01
Utility function to split content into fragments by a search query which are either matches or non-matches; useful for marking search query matches with bold text.
export default {
/**
* Searches the provided `content` by the terms within the `searchQuery` and
* splits up the content into fragments which are either matches or non-matches.
* It returns an Array of Objects, each of which has the following format:
*
* * `fragment` (String): The fragment of content
* * `match` (Boolean): True if the content is a match for one of the terms
* in the `searchQuery`
*