Skip to content

Instantly share code, notes, and snippets.

@judell
judell / gist:4ba3a5eb6828247c1267
Last active August 29, 2015 14:24
arxiv trackbacks
curl https://hypothes.is/api/search?user=arxiv&limit=30
{
"total": 26,
"rows": [
{
"updated": "2015-07-10T16:19:44.647522+00:00",
"target": null,
"created": "2015-07-10T16:19:44.647511+00:00",
"text": "[This article](http://arxiv.org/abs/0704.0354) was referenced by [\"179. Followup on ekpyrosis and phoenix universe\"](http://www.nonequilibrium.net/179-followup-ekpyrosis-phoenix-universe/) on Thursday, January 13 2000.",
Here's an API query that retrieves an annotation:
https://hypothes.is/api/annotations/AC0wFYQFQMGCSDQ9nfFW0A
Looking inside the result we find these equivalences:
"link": [
{
"href": "http://jcs.biologists.org/content/127/14/3052.long"
},
@judell
judell / mmr.py
Last active March 23, 2022 10:46
monthly morphometry report
import requests, re, json, types, traceback
class HypothesisAnnotation:
def __init__(self, row):
"""Encapsulate relevant parts of one row of a Hypothesis API search."""
self.tags = []
if row.has_key('tags') and row['tags'] is not None:
self.tags = row['tags']
@judell
judell / gist:6ec4af6392914e946d3b
Created July 30, 2015 18:56
homepage vs dev env bookmarklets
Homepage:
javascript:(function(){window.hypothesisConfig=function(){return{showHighlights:true};};var d=document,s=d.createElement('script');s.setAttribute('src','https://hypothes.is/app/embed.js');d.body.appendChild(s)})();
Dev env:
javascript:%28function %28window%2C document%2C location%29 %7B%0A var embedUrl %3D %27http%3A//localhost%3A5000/embed.js%27%3B%0A var isHTTPS %3D location.protocol.indexOf%28%27https%27%29 %3D%3D%3D 0%3B%0A var isEmbedHTTPS %3D embedUrl.indexOf%28%27https%27%29 %3D%3D%3D 0%3B%0A var isLocal %3D location.protocol %3D%3D%3D %27file%3A%27%3B%0A var isPDF %3D location.pathname.toLowerCase%28%29.indexOf%28%27.pdf%27%29 > 0%3B%0A var hasPDFjs %3D typeof window.PDFJS %21%3D%3D %27undefined%27%3B%0A var embed%3B%0A%0A if %28isLocal %26%26 %21isPDF%29 %7B%0A window.alert%28%27Sorry%2C Hypothesis doesn%5C%27t work on this type of file. Only PDF%5C%27s can be annotated locally.%27%29%3B%0A return%3B%0A %7D%0A if %28isPDF %26%26 %21hasPDFjs%29 %7B%0A window.alert%28%27S
@judell
judell / sitc.js
Last active August 29, 2015 14:27
SITC Prototype: Phase 1
/*
npm install dom-anchor-text-quote
npm install dom-seek
npm install jquery
browserify sitc.js -o sitc-bundle.js
*/
/*
<script src="./sitc-bundle.js"></script>
@judell
judell / trello.py
Created August 13, 2015 00:02
trello / github
import requests, json, re
backlog_triage_list = '55c39b276b173fdfaef897f1'
backlog_not_prioritized_list = '55a3fb6903a766588973e8c5'
backlog_backlog_list = '55796ed5c0e8c6a2f25dba6e'
sprint_up_next = '557936eed7f9bf6d2dd1521e'
sprint_in_progress = '5578c7a3f955667e94879086'
sprint_deployed = '555cab97ea82d6a4151b7f92'
sprint_delivered = '555cb1ea055301c6f20e50df'
/*
npm install dom-anchor-text-quote
npm install dom-seek
npm install jquery
npm install xpath-range
browserify anchor.js -o anchor-bundle.js
*/
/*
@judell
judell / gist:69362cd81b16e24c4624
Created September 25, 2015 21:34
2015-09-25 testing narrative: initial db state for test url
{
"rows": [
{
"updated": "2015-06-15T21:31:28.144726+00:00",
"group": "__world__",
"target": [
{
"scope": [
"http://blog.jonudell.net"
],
@judell
judell / rrid.py
Created November 23, 2015 16:37
rrid annotation
import json, requests, re, traceback, pyramid, urlparse
from lxml import etree
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
host = 'h.jonudell.info' # or your own
port = 8081
host_port = 'http://' + host + ':' + str(port)
{
"target": [{
"scope": ["http://www.jneurosci.org/content/35/20/7777.full"],
"selector": [{
"exact": "nif-0000-30467",
"prefix": "f Health; ",
"type": "TextQuoteSelector",
"suffix": ") and lesio"
}]
}],