Skip to content

Instantly share code, notes, and snippets.


Sean Hammond seanh

View GitHub Profile
seanh /
Last active Oct 16, 2021
HTML Tags You Can Use on GitHub

HTML Tags You Can Use on GitHub

Wherever HTML is rendered on GitHub (gists, README files in repos, comments on issues and pull requests, ...) you can use any of the HTML elements that GitHub Flavored Markdown (GFM) provides syntactic sugar for. You can either use the syntactic sugar that GFM (or other GitHub-supported markup language you're using) provides or, since Markdown can contain raw HTML, you can enter the HTML tags manually.

But GitHub also allows you to use a few HTML elements beyond what Markdown provides by entering the tags manually, and some of them are styled with CSS. Most raw HTML tags get stripped before rendering the HTML. Those tags that can be generated by GFM syntactic sugar, plus a few more, are whitelisted. These aren't documented anywhere that I can find. Here's what I've discovered so far:

<details> and <summary>

A `<detai

seanh / how-the-client-is-configured.markdown
Last active Sep 22, 2019
How the Hypothesis client configures itself
View how-the-client-is-configured.markdown

How the client is configured

There are several different files in the client source code that read configuration (also sometimes called "options" or "settings") from different places.

An additional difficulty is that the client consists of two separate components:

  1. The code in src/annotator/ is JavaScript code that's injected directly
seanh / README.markdown
Last active Sep 16, 2017
Embedding Hypothesis in a Single Page App
View README.markdown

This is a very rough demonstration of how to embed Hypothesis in a single page app.

When you click on the "Go to page two" button it loads the second "page" of the app. This page is just loaded by JavaScript, without having the browser load a new page as it would normally do when following a link. Importantly the JavaScript code does change URL in the browser's location bar though, using history.pushState(). Before changing the URL it unloads Hypothesis from the page, and after changing the URL it reloads Hypothesis into the page. This is to work around a limitation with Hypothesis - it doesn't detect URL changes done by pushState() and reload the annotations.



Notes about [tmux][] from various sources, including:

  • [tmux: Productive Mouse-Free Development][]
  • [Practical Tmux][]
  • [Arabesque's tmux posts][]
  • [Tmux on the ArchWiki][]
seanh / contentScript.js
Last active Dec 22, 2015
Chrome extension PDF detection with GET request from event page and using activeTab permission
View contentScript.js
* Check if the request is a PDF file.
* @param {Object} details First argument of the webRequest.onHeadersReceived
* event. The properties "responseHeaders" and "url"
* are read.
* @return {boolean} True if the resource is a PDF file.
function isPdfFile(response, url) {
var header = response.getResponseHeader('content-type');
if (header) {
seanh / 2645a9c857af1402bf63.crx
Last active Dec 22, 2015
Chrome extension PDF detection with GET request from event page
seanh / 27bdaa36aca3b6d6ffa9.crx
Last active Dec 22, 2015
Chrome extension PDF detection with GET request from content script
seanh / 85c02c1a0f309abab988.crx
Last active Dec 22, 2015
Chrome extension PDF detection with webRequest
seanh / README.markdown
Last active Oct 2, 2015
How to setup your local dev instance of h with a Dockerised PostgreSQL
View README.markdown

One-time startup:

docker run -d --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=pass postgres
echo 'localhost:5432:postgres:postgres:pass' >> ~/.pgpass
chmod go-rwx ~/.pgpass
pip install psycopg2

After this you just have to run docker start postgres to start it (e.g. after rebooting your laptop).

The SQLAlchemy URL in conf/development.ini should be:

seanh /
Last active Sep 22, 2015
Copy an annotatation from one Hypothesis instance to another
#!/usr/bin/env python2.7
import argparse
import json
import requests
def get_annotation(url, id_):
return requests.get(url + "/api/annotations/" + id_).json()