Skip to content

Instantly share code, notes, and snippets.

View kentbrew's full-sized avatar

Kent Brewster kentbrew

View GitHub Profile
@kentbrew
kentbrew / how_to_get_your_stuff_on_pinterest.md
Last active February 13, 2025 15:08
How To Get Your Stuff On Pinterest

Here's a doc we never published while I was at Pinterest. Some or all of it may be useful; please keep in mind that I've been ex-Pinterest since March 2022 and cannot help if it doesn't work.

I apologize in advance for the chirpy Pinterest editorial tone throughout; it's a Thing there.

How To Get Your Stuff On Pinterest

Hi, all. Kent Brewster here, oldest surviving engineer at Pinterest. For the past ten years we've been working on a handful of things that help people who love Pinterest find new inspiration from the Web and share it as easily as possible.

These things are:

@kentbrew
kentbrew / finding_twitter_user_id.md
Last active June 3, 2025 03:58
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
kentbrew / spinny_button.svg
Last active January 31, 2018 18:48
Recreating the Pinterest Spinny Button
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kentbrew
kentbrew / lang_chrome_osx.md
Last active June 19, 2025 02:14
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 com.google.Chrome AppleLanguages

If you see this:

@kentbrew
kentbrew / content.js
Last active January 5, 2018 17:59
Alt-Titler: fill blank image TITLE attributes with what's in their ALT attribute, if found.
// 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
kentbrew / background.js
Last active November 30, 2017 23:44
Tracker Jacker
const BLOCK_ME = "://www.facebook.com/tr/";
chrome.webRequest.onBeforeRequest.addListener(
function(r) {
return {
cancel: r.url.indexOf(BLOCK_ME) != -1
};
},
{urls: ["<all_urls>"]},
["blocking"]
@kentbrew
kentbrew / DOMParser_input_cleaner.md
Last active June 2, 2022 19:49
Using DOMParser to clean HTML input

Old School:

  var clean = function (input) {
    var testMe = input, dupeTest = '';
    while (testMe !== dupeTest) {
      testMe = new DOMParser().parseFromString(testMe, "text/html").documentElement.textContent;
      dupeTest = testMe;
    }
    testMe = testMe.replace(/</g, '&lt;');

return testMe;

@kentbrew
kentbrew / readme.md
Created July 11, 2017 02:43
Some Notes On Zetterberg's Static Search Widget
@kentbrew
kentbrew / wilensky.js
Created July 9, 2017 14:47
Imagine a room full of 100 people with 100 dollars each. With every tick of the clock, every person with money gives a dollar to one randomly chosen other person. After some time progresses, how will the money be distributed?
// paste me into console to explore the counterintuitive problem found here:
// http://www.decisionsciencenews.com/2017/06/19/counterintuitive-problem-everyone-room-keeps-giving-dollars-random-others-youll-never-guess-happens-next/
// setup: tweak as needed
var rounds = 10, turns = 1000, max = 100, start = 100;
// play one round
var round = function () {
// setup
@kentbrew
kentbrew / behavior.js
Created June 23, 2017 19:57
Scale and Render an Image for Visual Search
(function (w, d, a) {
var $ = w[a.k] = {
"a": a, "w": w, "d": d,
"s": {},
"v": {},
"f": (function () {
return {
// get a DOM property or text attribute
get: function (el, att) {
var v = null;