Skip to content

Instantly share code, notes, and snippets.

@bmccormack
bmccormack / hide_appointments.js
Created February 12, 2018 15:45
Hide Appointment Events on Google Calendar
// This is really weird. It works, but only after I "inspect element" on an element on the page. I have no idea
// why it doesn't work until I do that. ¯\_(ツ)_/¯ 
document.querySelectorAll('.DPvwYc.H8Utbd').forEach(function(e){console.log(e.parentNode.parentNode.parentNode.style.display='none')})
@bmccormack
bmccormack / bookmarklet.md
Created January 15, 2018 17:55
Bookmarklet to open Zap History while viewing a Zapier Zap

Add a new bookmarklet in Chrome called "Zap History". For the URL, enter the following:

javascript:(function()%7Bwindow.open(location.href.split("%2Fapp%2F")%5B0%5D %2B "%2Fapp%2Fhistory%3Fpage%3D1%26root_id%3D" %2B location.href.split("%2Feditor%2F")%5B1%5D.split("%2F")%5B0%5D%2C "_blank")%7D)()```

Now, when editing a Zap in Zapier, you can click the Bookmarklet to go directly to the Zap's History:

screencast

@bmccormack
bmccormack / hide_by_label_name.js
Created December 19, 2017 15:34
Hide Trello cards with label name
//change "Received" to the name of the label whose card you want to hide.
$('span[title^="Received"]').closest('.list-card').addClass('hide')
@bmccormack
bmccormack / query_zendesk_search_delete_spam.py
Last active November 16, 2017 14:32
Delete a bunch of sh*t tickets from Zendesk. Ahem.
import requests
import urllib
import re
import datetime
from secrets import zendesk_user, zendesk_token
from util import jprint
import sys
import time
@bmccormack
bmccormack / custom_and_log.js
Created September 28, 2017 13:18
Set FullStory custom vars and log them to FS.log() at the same time
// Use this to set FullStory custom var data and log data at
// the same time. This will cause your custom vars to be visible
// in the FullStory javascript console, but they will not be
// visible in the browser console to the end user.
// See http://help.fullstory.com/develop-js/setuservars
// for how to format data.
function setUserVarsAndLog(data){
FS.setUserVars(data);
FS.log(data);
@bmccormack
bmccormack / readme.md
Last active May 26, 2019 14:55
Relative anchor links for your documentation

You know relative anchor links, right? They're the things that help you to link to a section of a document, e.g. https://example.com/your-doc#part-of-doc. This is especially helpful for customer support help centers (knowledge bases, documentation, etc).

I can never ever remember how to do this, so I'm making this gist to store my brain on the internet. Here are some things I forget:

  • Use name to name your relative link
  • Don't include # in the name value
@bmccormack
bmccormack / example_cron.txt
Last active December 21, 2021 03:03
Tips and tricks for being successful with CRON
* * * * * env > /tmp/env.output
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:~/bin
PYTHONPATH=/usr/lib/python2.7/dist-packages:$PYTHONPATH
* * * * * env > /tmp/env2.output
*/2 * * * * . /home/ben/example.sh > /home/ben/.example.log 2>&1
* * * * * date > .date.tmp
@bmccormack
bmccormack / README.md
Last active November 2, 2017 18:40
Get count of tags within a Zendesk search Python script

##Before you begin

This is designed for Python 2.7. You'll need to have the requests package installed.

##Setup

  1. Setup 3 files that correspond to the 3 Python files in this gist within a single folder.
  2. In secrets.py, add your Zendesk account email and token. To get a token, from within Zendesk, go to Settings > API > Token Access (Enabled), then click the plus sign near "Active API Tokens".
  3. In query_zendesk_search_stats_tags.py, change SEARCH and ZENDESK_SUBDOMAIN for your needs.
  4. To run, type python query_zendesk_search_stats_tags.py from the command line and press enter. It will take about 2.5 seconds for each 100 tickets in the search. E.g. 811 tickets took ~22 seconds.
import json
#via http://stackoverflow.com/a/12944035/166258
def jprint(to_print, indent=4, sort_keys=True):
print json.dumps(to_print, indent=indent, sort_keys=sort_keys)
@bmccormack
bmccormack / README.md
Last active July 25, 2016 22:49
Print Trello Cards - Removes cruft so the description and checklists stand out

This little bit of javascript tries to make Trello cards look a bit nicer when printed, especially for checklists. It gets rid of some of the extra UI elements so the content shows through.

To convert to a bookmarklet:

  1. Copy the above code to the code box on this page
  2. Click the button
  3. Drag the link to your bookmark bar.
  4. Optionally, right click on the bookmarklet and change the name to "Print Trello Card".