Skip to content

Instantly share code, notes, and snippets.


Jared Hirsch 6a68

View GitHub Profile
6a68 / gist:4963424
Last active Sep 21, 2020
ETags & If-None-Match headers: a dialogue
View gist:4963424

ETags & If-None-Match headers: a dialogue

1st request.

browser: can haz foo?

GET /foo HTTP/1.1

1st response.

6a68 / gist:4971859
Created Feb 17, 2013
all about ETags
View gist:4971859

ETags: a pretty sweet feature of HTTP 1.1

HTTP caching review

HTTP provides two ways for servers to control client-side caching of page components:

  • freshness may be based on a date or a token whose meaning is app-specific
  • whether or not the client needs to confirm the cached version is up-to-date with the server

This breaks down as follows:

  • Cache locally and don't check before using.
6a68 / gist:c9be82b168c5c823b407
Last active Feb 11, 2020
how to delete your tweets just using your browser, no oauth required
View gist:c9be82b168c5c823b407
// 1. go to your twitter feed with tweets and replies
// for example, mine was
// 2. scroll all the way down to the bottom of the page.
// I suppose you could automate this with JS, but I didn't.
// this function will delete tweets you can delete, i.e. not retweets:
function deleteTweets() {
// find the next delete button in the DOM (next deletable tweet)
// and click the delete button. I wanted to keep the first tweet,
// which is why the index here is 1.
if (!$('.js-actionDelete').length) {
6a68 /
Last active Nov 6, 2019
attaching debuggers to things

(Note: I moved this info into the main FxA readme at

Attaching a debugger to a running node process, sadly, requires running google chrome (AFAIK).

How to do it:

  1. Start google chrome and open up chrome://inspect.

  2. Run a node process using the --inspect or --inspect-brk flags (see specific command-line incantations below)

6a68 / ugh
Created Jul 9, 2019
fxa monorepo npm install = node-gyp dumpster fires
View ugh
[15:51:37 mozilla-fxa (mozilla-master) ]$ npm install
> fxa@2.0.0 postinstall /Users/jh/codez/github/mozilla-fxa
> _scripts/
+ '[' '' = true ']'
+ _scripts/
+ _scripts/
++ which rustup
+ [[ ! -n /Users/jh/.cargo/bin/rustup ]]
View foo
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "src/libbacktrace" "-I" "/Users/jh/codez/github/mozilla-fxa/packages/fxa-email-service/target/debug/build/backtrace-sys-a925084960b3e8d2/out" "-fvisibility=hidden" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktr
6a68 / :-(
Created Jul 9, 2019
fxa-auth-server: trying to install on node 10.16.0 / mac 10.14.5
View :-(
[15:15:11 fxa-auth-server (mozilla-master) ]$ npm install
> @newrelic/native-metrics@3.1.2 install /Users/jh/codez/github/mozilla-fxa/packages/fxa-auth-server/node_modules/@newrelic/native-metrics
> node ./lib/pre-build.js install native_metrics
> /usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
> /usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 6 native_metrics
CXX(target) Release/
CXX(target) Release/
CXX(target) Release/
6a68 / foo
Created Jul 9, 2019
fxa-js-client errors after npm setup && npm test without separately installing intern-geezer
View foo
[09:00:49 fxa-js-client (mozilla-master) ]$ npm run test
> fxa-js-client@1.0.14 test /Users/jh/codez/github/mozilla-fxa/packages/fxa-js-client
> grunt test
Running "intern:node" (intern) task
DEBUG: 'failed to load resource (/Users/jh/codez/github/mozilla-fxa/packages/fxa-js-client/node_modules/intern-geezer/node_modules/dojo/_base/array.js)'
DEBUG: { Error: ENOENT: no such file or directory, open '/Users/jh/codez/github/mozilla-fxa/packages/fxa-js-client/node_modules/intern-geezer/node_modules/dojo/_base/array.js'
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:343:35)
6a68 / foo.diff
Created Jan 26, 2019
Converting hostname to login title: the PSL approach
View foo.diff
commit d67700eadc05178d275d526bd696f2dacaf83221
Author: Jared Hirsch <>
Date: Tue Jan 22 16:21:23 2019 -0800
Add Logins API utility method to get domain name, minus TLD, from a URL
diff --git a/src/experiments/logins/api.js b/src/experiments/logins/api.js
index 15dbf53..71412a2 100644
--- a/src/experiments/logins/api.js
+++ b/src/experiments/logins/api.js
6a68 / howto-detumblrize.mkd
Last active Oct 25, 2018
Downloading stuff off of tumblr
View howto-detumblrize.mkd

TL;DR skip to the summary for the bash one-liner if so inclined :-)

Why & wherefore

I have an old tumblr that I want to back up. I don't use it regularly, but I want to have a backup of the whole site, design as well as content, just in case; it's not just the pictures I love, but the whole thing. I'm not particularly worried about downloading the streaming audio--can't help you there, gentle reader.

You can’t perform that action at this time.