Skip to content

Instantly share code, notes, and snippets.

View jaredhirsch's full-sized avatar
🙃
mostly working in mozilla repositories these days

Jared Hirsch jaredhirsch

🙃
mostly working in mozilla repositories these days
View GitHub Profile
@jaredhirsch
jaredhirsch / gist:c065bd2b487a3535504e
Last active August 29, 2015 14:10
exporting firefox history

goal: export my history into a JSON blob that can be imported into a web service.

exporting bookmarks in FF is very easy, but history is a bit harder.

  1. find your profile

this sumo page suggests that you go to about:support and click on the 'show in finder' button to find your profile

  1. extract history from the places.sqlite sqlite3 database
@jaredhirsch
jaredhirsch / gist:6cbc7e88c57287dac417
Last active August 29, 2015 14:11
looking at hapi repo organization within cloud services
existing repos
==============
fxa-profile-server
/bin
- looks like this just does instantiation, dependency injection,
like the /server directory in the fxa-auth-server repo
- _static.js - load local-dev-only static server
- server.js - just load lib/server and start it, pass in the logger
- worker.js - just load lib/server/worker and call create
@jaredhirsch
jaredhirsch / gist:48bf56e5b66e8631b522
Last active August 29, 2015 14:17
API between autocomplete code and iframe

Deprecation notice

This API corresponds to the state of the abandoned gecko fork. The project has been ported to an addon which contains the up-to-date API docs in its repo.


browser - iframe API

@jaredhirsch
jaredhirsch / gist:192084385deaa414fb40
Last active August 29, 2015 14:22
addons - tricks and weirdness
/* 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: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

# 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"

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).

@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>
@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?