Skip to content

Instantly share code, notes, and snippets.

Kent Brewster kentbrew

Block or report user

Report or block kentbrew

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kentbrew /
Created Dec 2, 2019
The One True White Elephant Gift Exchange Ruleset

The One True White Elephant Gift Exchange Ruleset

Gifts must:

  • Cost less than the maximum price limit, to be announced beforehand. (Yes, zero is less than the maximum price limit, as is the negative value of a truly awful white elephant.)
  • Be placed in a location where players can see all of them without touching them.
  • Be wrapped for easy extraction. Gift bags are best.
  • Number the exact number of players.

Players must:

kentbrew /
Created Nov 13, 2019
Testing Extensions on Chrome Canary

Testing Extensions on Chrome Canary

Kent Brewster, 2019-11-13. For fastest contact, Twitter is your best bet; I'm @kentbrew there and everywhere else that hasn't already kicked me off.

At long last it's time to get serious about Manifest V3:

Problem: all the cool new toys only work in Chrome Canary. If you're like me, your chrome://extensions page is already a giant mass of internally-conflicting test extensions and you dislike the taste of coal dust, so you've avoided Canary versions of Chrome at all costs.

kentbrew /
Last active Oct 31, 2019
Avoiding repetition when deciding whether a member exists several layers deep inside an object.

Object Spelunking

This is trouble:

if ( === 8675309) {
kentbrew /
Last active Aug 30, 2019
Sorting a JSON Object by Key Name

Sorting a JSON Object by Key Name

While performing eyeball-based QA for an API update I needed a fast way to reformat output so that all keys would be in the same order. Here's what I came up with:

sortByKeys = input => {
  // default: return anything whose typeof is NOT "object"
  let result = input;
  // do we have an object? look inside
  if (input && typeof input === "object") {
kentbrew /
Created Mar 4, 2019
Hiding Ads from All Facebook Advertisers who have Added You From a Contact List

Hiding Ads from All Facebook Advertisers who have Added You From a Contact List

Here's a scary page:

Open up the Advertisers section and check out that first section: advertisers who use a contact list added to Facebook. Unlike the other tabs in this section, these ads have nothing to do with your behavior on Facebook or elsewhere on the Internet. All these advertisers got your name the old-fashioned way: by trading something of value for a list containing your contact information.

Per Facebook's vague-but-cheerful explainer, this is "typically" your e-mail address or phone number, but there's really no way to know for sure.

kentbrew /
Last active May 10, 2019
Finding Twitter User IDs

Finding Twitter User IDs

User accounts on Twitter are commonly identified by screen name, which may be changed by operators when they take over an account, or have been sitting on an old account for a long time and want to transition it into malicious use.

User IDs, however, are permanent. There are several services out there that will try to find them for you but it seems like a bad idea to me, since you're alerting them to the fact that there's something interesting about this account. There's also plenty of bad advice that uses many long-since-abandoned Twitter API endpoints.

As of this writing (2018-02-18) you can view source and search for /profile_banners/, which will show something like this:

.enhanced-mini-profile .mini-profile .profile-summary {
kentbrew / spinny_button.svg
Last active Jan 31, 2018
Recreating the Pinterest Spinny Button
View spinny_button.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
kentbrew /
Last active Dec 22, 2019
How to change the Chrome default language on OSX

How to Change your Chrome Default Language

Open up a Terminal window. (If you have never seen Terminal before, go to Spotlight Search and type "Terminal.")

In the Terminal box, try this:

defaults read AppleLanguages

If you see this:

kentbrew / content.js
Last active Jan 5, 2018
Alt-Titler: fill blank image TITLE attributes with what's in their ALT attribute, if found.
View content.js
// Fill blank image TITLE attributes with what's in their ALT attribute, if found.
((w, d) => {
let $ = {
// w = window
w: w,
// d = document
d: d,
f: {
// return an event's target element
kentbrew / background.js
Last active Nov 30, 2017
Tracker Jacker
View background.js
const BLOCK_ME = "://";
function(r) {
return {
cancel: r.url.indexOf(BLOCK_ME) != -1
{urls: ["<all_urls>"]},
You can’t perform that action at this time.