Skip to content

Instantly share code, notes, and snippets.

@judell
judell / gist:f794f719a5240de9f939
Created April 29, 2015 22:35
all annotations
import json, urllib2, re
offset = 0
limit = 200
more = True
def search():
global offset, limit, more
h_url = 'https://hypothes.is/api/search?limit=%d&offset=%d' % ( limit, offset)
s = urllib2.urlopen(h_url).read()
@judell
judell / gist:b287a63867e4123aded0
Created May 7, 2015 00:35
hypothesis ambiguity analysis
Annotations on these URLs share a normalized URL but have no other metadata links:
thedeadcanary.wordpress.com/2014/05/11/song-of-myself
https://thedeadcanary.wordpress.com/2014/05/11/song-of-myself/
id: jk7WvHAQTmm5I3neJLp2tw updated: 2015-01-14T03:00:45.400846+00:00
Annotations on these URLs share a normalized URL but have no other metadata links:
scalar.usc.edu/works/deterrence/the-deterrence-gap
http://scalar.usc.edu/works/deterrence/the-deterrence-gap
id: 1qovOTRTQQa6htuXLFB0wA updated: 2013-11-14T21:16:14.452675+00:00
@judell
judell / gist:d97c135f540811d65f62
Created June 1, 2015 16:56
create annotation
import requests,json
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
class Hypothesis:
import json, traceback, requests, types
from collections import defaultdict
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
class HypothesisUtils:
https://books.google.com/books?id=0oJEBQAAQBAJ&pg=PT117&lpg=PT117&dq=Dorothy+Vaneman&source=bl&ots=qE6gfXQL4v&sig=1ZnhfVlwmVGo2JWEGkBthw_OhVc&hl=en&sa=X&ei=b_gtVbL3N8uyoQS5-YDoDw&ved=0CEkQ6AEwCw (2015-04-15T05:42:10)
https://books.google.com/books/about/The_Skylark_of_Space.html?id=0oJEBQAAQBAJ
http://www.homeopathicassociates.com/conditions-homeopathic-treatment/ (2015-02-11T20:12:51)
http://www.homeopathicassociates.com/?p=12313
http://ecdaproject.org/commons/ (2015-05-07T19:49:59)
http://wp.me/P5mdo0-Ch
<html>
<head>
<title>urls recently annotated with hypothesis</title>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js"></script>
<style>
body { margin-left: .5in; margin-top:.25in; font-family:verdana; word-break:break-word; font-size:11pt }
a { color: gray }
#widget { width: 50%; padding:8px; border-width:thin; border-style:solid }
</style>
</head>
@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 / 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>