Skip to content

Instantly share code, notes, and snippets.

Jon Udell judell

Block or report user

Report or block judell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View plpython.md

Installed extensions

h_analytics=# select name, default_version, installed_version from pg_available_extensions  where installed_version is not null;
   name    | default_version | installed_version
-----------+-----------------+-------------------
 uuid-ossp | 1.1             | 1.1
 plpgsql   | 1.0             | 1.0
(2 rows)
@judell
judell / internal_and_public_id
Created Aug 7, 2019
convert between hypothesis internal and public ids
View internal_and_public_id
import base64, uuid, binascii, traceback
ES_FLAKE_MAGIC_BYTE = ['e', '5']
def _must_b64_decode(data, expected_size=None):
result = base64.urlsafe_b64decode(data)
if expected_size is not None and len(result) != expected_size:
raise TypeError('incorrect data size')
return result
View addMembers.js
names = [
'user a',
'user b',
'user c',
]
for (let i = 0; i < names.length; i++) {
Array.from(document.querySelectorAll('button')).filter(b => b.innerText == 'Add member')[0].click()
}
@judell
judell / wsclient.js
Last active Feb 3, 2020
minimal hypothesis websocket client for js
View wsclient.js
function connect() {
return new Promise(resolve => {
var ws = new WebSocket('wss://hypothes.is/ws?access_token=...')
function waitSocket() {
if (ws.readyState == 1) {
clearInterval(interval)
resolve(ws)
}
}
var interval = setInterval(waitSocket, 1000)
@judell
judell / wsclient.py
Last active Jun 14, 2019
minimal hypothesis websocket client for python
View wsclient.py
import asyncio
import ssl
import uuid
import json
import certifi
import websockets
import traceback
def _ssl_context(verify=True):
ssl_context = ssl.create_default_context(cafile=certifi.where())
View Hypothesis System Overview.md

An overview of the Hypothesis system

The Hypothesis project delivers a set of components and capabilities that work together to enable a wide range of annotation-powered applications. Here we summarize the state of play in November 2018. The major components are:

  • An annotation viewer and editor that runs as an overlay in the browser ("the client").

  • An annotation service that stores, searches, and displays annotations, manages users and groups, and delivers the client into pages that actively embed it ("the service").

  • A Chrome extension that injects the client into web pages that don't embed it ("the extension").

View nav-by-highlight.js
delete hypothesisHighlights
hypothesisHighlights = Array.from(document.body.querySelectorAll('hypothesis-highlight'))
var hypothesisIndex = 0
document.body.addEventListener('keydown', function (e) {
let hl
if (e.key === 'ArrowDown' && hypothesisIndex < hypothesisHighlights.length) {
document.body.scrollIntoView(true)
@judell
judell / hypothesis shortcode
Created Jul 6, 2018
wordpress shortcode implementation for embedding hypothesis annotations
View hypothesis shortcode
add_action( "wp_enqueue_scripts", "hypothesis_annotation_enqueue_scripts_styles" );
function hypothesis_annotation_enqueue_scripts_styles() {
wp_enqueue_style("hlib.css", "https://jonudell.info/hlib/hlib.css");
wp_enqueue_script("hlib.bundle.js", "https://jonudell.info/hlib/hlib.bundle.js");
wp_enqueue_script("showdown.js", "https://jonudell.info/hlib/showdown.js");
}
function hypothesis_annotation($args) {
$id = $args["id"];
View gist:5ca5e2bae6b15dd19fc8b9103d592503
24633418, 10.1007/s11095-014-1350-2
22328479,
25352860, 10.3389/fgene.2014.00314
22252949, 10.1136/ebmh.2011.100485
27402678, 10.1093/database/baw104
25381999, 10.1002/ajhb.22653
25526083, 10.1371/journal.pone.0115069
12493661, 10.1136/bmj.325.7378.1449
19008233, 10.1074/jbc.m806974200
25072471, 10.1038/ncomms5510
View gist:40991252881f9c200fb0fec09ed20b53
10029393
10069051
10091204
10173177
10194578
10185143
10202165
10232298
10344553
10340298
You can’t perform that action at this time.