Skip to content

Instantly share code, notes, and snippets.

View jaredhirsch's full-sized avatar
:octocat:
pretty excited firefox is moving from hg to github!

Jared Hirsch jaredhirsch

:octocat:
pretty excited firefox is moving from hg to github!
View GitHub Profile
@jaredhirsch
jaredhirsch / foo.md
Created January 6, 2016 01:51
proposal: quantifying perceived performance for the search addon

TL;DR: let's render in 100ms or less, and also put the counter in the corner when in debugging mode.

How to plug in a different little machine

  1. Open FF
  2. Install the universal search addon if you haven't already
  3. Enable the Browser Toolbox
  4. Open the browser toolbox
  5. Switch the debugger to the iframe context using this funky little menu button:
  6. Do this in the console: window.app.searchUrl = 'https://your.server.com/?q=';
  • The query term will be escaped and appended to the searchUrl
  1. Now, as you type, the second item in the top section will be fetched from your server:
@jaredhirsch
jaredhirsch / draft.md
Created September 24, 2015 15:07
basic principles front-end programming

Idea: basic principles front end development

The stuff that is evergreen: basic facts and techniques

The web moves fast. Decouple the fads from the basic principles that don't change.

This could be a short book that teaches you how to think.

  • Event loop: implicit multi threading
  • DOM as tree structure
@jaredhirsch
jaredhirsch / foo.markdown
Created August 4, 2015 00:17
activity feed in a hurry

What do we need?

  1. Scrape a page
  2. store the result in a relational DB
  3. also store the result in a full text index
  4. expose search API
  5. on search hit, return the full record & any score

How do we do this quickly / easily?

@jaredhirsch
jaredhirsch / foo.markdown
Created August 3, 2015 23:55
Reader Mode output for

here's the content, newlines inserted by me.

  • there is a lot of crap left in here, lot of html tags
  • the entities are escaped, so anything here should be safe to display
"<div id="readability-page-1" class="page">
<article itemtype="http://schema.org/Article" itemscope="" data-article="3983182" id="article-3983182" class="clearfix full-article   time_article metered   ">
<header class="article-header">
  <section class="tags ">
    <a href="http://time.com/" class="brand-tag brand-time-tag">TIME</a>

I had this idea a couple years ago, but I think I've found a way to simplify the whole thing.


Email as web pages:

Fundamentally, email is just a message written by one person, intended for another.

Use RSS to see if a friend sent you a message (auth'd RSS access).

# development use only
Daemon 0
LogFacility -
ListenHTTPS
Address 0.0.0.0
Port 3443
Cert "tmp/certificates/ssl.pem"
xHTTP 1
AddHeader "X_FORWARDED_PROTO: https"
@jaredhirsch
jaredhirsch / gist:40b5eda14c82a25e253b
Created June 19, 2015 21:00
firefox addon development: getting SSL working locally

I'm working on an addon which includes an iframe served over https. https is needed for WebChannel (chrome to content) communication to work. It's also going to be needed to find and avoid mixed-content warnings as we pull various bits of remote content into that frame.

Setting this all up is medium-unpleasant, as ops tasks go. I want to remember how I did it, so here are some quick notes:

Assuming you're using the built-in Apache2 install on OSX Yosemite, follow these guides:

You can't just click to accept self-signed certs in iframes in FF; the idea is to prevent clickjacking. (See https://bugzil.la/792479 for more.) To work around this, make yourself a certificate authority in your Firefox a

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// TODO: it would be nice to check size of places DB before starting (precondition?)
// TODO: do we need to listen for shutdown events to avoid corrupting the DB?
// or does PlacesUtils handle that for us?
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
@jaredhirsch
jaredhirsch / gist:192084385deaa414fb40
Last active August 29, 2015 14:22
addons - tricks and weirdness