Skip to content

Instantly share code, notes, and snippets.

@judell
judell / wikipedia articles with public annotations
Last active April 20, 2016 17:41
annotated wikipedia urls as of 4/12/2016
http://ar.wikipedia.org/wiki/%D9%85%D8%AD%D9%85%D8%AF_%D9%85%D8%B1%D8%B3%D9%8A
http://arstechnica.com/staff/2015/12/editorial-wikipedia-fails-as-an-encyclopedia-to-sciences-detriment/
http://de.wikipedia.org/w/index.php?title=Hermann_Ostfeld&redirect=no
http://de.wikipedia.org/wiki/Abraham_Horodisch
http://de.wikipedia.org/wiki/Adolf_Wohlwill
http://de.wikipedia.org/wiki/Alphonse_Levy
http://de.wikipedia.org/wiki/Arno_Nadel
http://de.wikipedia.org/wiki/Arthur_Ruppin
http://de.wikipedia.org/wiki/Bruno_Strauss
http://de.wikipedia.org/wiki/Clara_Anschel
{
"rows": [
{
"updated": "2016-08-15T23:45:54.379082+00:00",
"group": "__world__",
"target": [
{
"source": "https://www.theguardian.com/environment/2016/aug/02/environment-climate-change-records-broken-international-report",
"selector": [
{
def url_transfer_row(id=None, url_dest=None, username=None, token=None):
h = Hypothesis(username=username, token=token)
row = h.get_annotation(id)
try:
row['user'] = 'acct:' + h.username + '@hypothes.is'
permissions = row['permissions']
permission_fields = ['admin','update','delete']
for field in permission_fields:
permissions[field][0] = 'acct:' + h.username + '@hypothes.is'
row['permissions'] = permissions
@judell
judell / test.py
Created April 10, 2017 19:55
pydrive auth example
def get_gdoc_access_token():
refresh_token = '1/yxDrJ ... redacted ... ADXvCU'
client_id = 'redacted.apps.googleusercontent.com'
client_secret = 'redacted'
refresh_url = 'https://accounts.google.com/o/oauth2/token'
data = 'refresh_token=%s&client_id=%s&client_secret=%s&grant_type=refresh_token' % (refresh_token, client_id, client_secret)
r = requests.post(refresh_url, data, headers={'Content-Type':'application/x-www-form-urlencoded'})
response = json.loads(r.text)
access_token = response['access_token']
return access_token
# https://h.jonudell.info/h_share?id=sXl8jPYkEeaFkovibrSZ-g
@view_config( route_name='h_share' )
def h_share(request):
q = urlparse.parse_qs(request.query_string)
id = q['id'][0]
logger.info('id %s' % id)
row = requests.get('https://hypothes.is/api/annotations/' + id).json()
anno = HypothesisAnnotation(row)
diff --git a/src/sidebar/frame-sync.js b/src/sidebar/frame-sync.js
index 8a80563..b4dec82 100644
--- a/src/sidebar/frame-sync.js
+++ b/src/sidebar/frame-sync.js
+ // if doi available as highwire or dc meta, include in search
+
+ if ( info.metadata && info.metadata.highwire && info.metadata.highwire.doi )
+ searchUris = searchUris.concat('doi:' + info.metadata.highwire.doi[0]);
+
def genius_test():
h = Hypothesis(username="judell",
token='6879- ... a3df5',
group='Pk ... gL')
anno_id = '12192534'
genius_token = 'yOalM ... R4MuU'
url = 'https://api.genius.com/annotations/' + anno_id
headers = {'Authorization': 'Bearer ' + genius_token, 'Content-Type': 'application/json;charset=utf-8' }
def genius_test():
h = Hypothesis(username="judell",
token='6879- ... a3df5',
group='Pk ... gL')
anno_id = '12192534'
genius_token = 'yOalM ... R4MuU'
url = 'https://api.genius.com/annotations/' + anno_id
headers = {'Authorization': 'Bearer ' + genius_token, 'Content-Type': 'application/json;charset=utf-8' }
@judell
judell / gist:a5d378cf78ff713263cc6af48aafa60f
Created September 1, 2017 16:11
Pundit json-ld export of comment and reply
[{
"@id": "_:0be8406951cdfda82f00f79328cf4efc",
"@type": ["http:\/\/www.openannotation.org\/ns\/EmbeddedContent"],
"http:\/\/purl.org\/dc\/elements\/1.1\/format": [{
"@value": "text\/plain"
}],
"http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#value": [{
"@value": "Comment"
}]
}, {
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebPage",
"mainEntity": {
"@type": "Article",
"author": {
"@type": "Organization",
"logo": "https://climatefeedback.org/wp-content/themes/wordpress-theme/dist/images/Climate_Feedback_logo_s.png",
"name": "Climate Feedback"