Skip to content

Instantly share code, notes, and snippets.

View andrewmacheret's full-sized avatar

Andrew Macheret andrewmacheret

View GitHub Profile
// ==UserScript==
// @name Cal Merge for Google Calendar™ (by @HCAWN forked from @imightbeAmy, and then forked again by @andrewmacheret)
// @namespace gcal-multical-event-merge
// @include https://www.google.com/calendar/*
// @include http://www.google.com/calendar/*
// @include https://calendar.google.com/*
// @include http://calendar.google.com/*
// @require https://github.com/gka/chroma.js/blob/main/chroma-light.min.js
// @version 1
// @grant none
@andrewmacheret
andrewmacheret / async-cache.js
Created October 21, 2019 22:32
cache of an async function
const resultMap: Map<string, any> = new Map();
const loadData = async (loader: Function, ...args: any) => {
// is there a better way...
const key = JSON.stringify(args);
if (resultMap.has(key)) {
const val = resultMap.get(key);
if (val.state === 'loading') {
return await val.promise();
} else if (val.state === 'failed') {
// ==UserScript==
// @name Hide locked, add like/dislike
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://leetcode.com/problemset/*
// @grant none
// ==/UserScript==
@andrewmacheret
andrewmacheret / bot.js
Created September 20, 2017 01:56
AWS Lambda function to tweet to use a specified twitter account and tweet the contents of a URL with it
const Twitter = require('lwt')
const request = require('request')
//const {promisify, callbackify} = require('util')
const promisify = require('es6-promisify')
const callbackify = require('callbackify')
const tweet = async (twitterSettings, tweetText) => {
// the following twitter settings are required:
// {
// "accessToken": "...",
const moment = require('moment-timezone');
const request = require('request-promise-native');
const nhlCssLink = require('./nhl-css-link');
const nhlApiUrl = 'https://statsapi.web.nhl.com/api/v1';
let cacheTeams = null;
const cacheSchedules = {};