Skip to content

Instantly share code, notes, and snippets.

@judell
judell / gist:9744381
Last active August 29, 2015 13:57
draft of CouchDB adaptor for TiddlyWiki
/*\
title: $:/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js
type: application/javascript
module-type: syncadaptor
A sync adaptor module for synchronising with Couch compatible servers
\*/
(function () {
@judell
judell / gist:632cc730c689e1c3572a
Created January 7, 2015 03:13
first step towards a wiki page inspector
(function() {
function getParas($item) {
debugger;
var s = '';
var href = $item.parent('.story').prev('.header').find('a').attr('href')
var id = href.match(/[^\/]+$/)[0];
var paras = $('#' + id).find('.paragraph p');
for ( var i = 0; i < paras.length; i++ ) {
var p = paras[i].innerText.substr(0,50) + ' ...';
@judell
judell / gist:bd5c2a6374dba27338e4
Created March 27, 2015 19:29
h query syntax discussion
11:58:31 AM judell nickstenn: thoughts on h/issues/2095 re: 1) syntax normalization across /stream and /api, 2) behavior normalization (search works differently)
11:59:11 AM nickstenn h#2095
11:59:12 AM vannevar Normalize URL syntax and query behavior across /api and /stream: https://github.com/hypothesis/h/issues/2095
11:59:23 AM GitHub64 joined the channel.
11:59:23 AM -GitHub64- [h] nickstenning force-pushed 1916-stream-cards from 1862529 to fe5cd6c: https://github.com/hypothesis/h/commits/1916-stream-cards
11:59:23 AM -GitHub64- h/1916-stream-cards fe5cd6c Gergely Ujvari: Fix controller tests
11:59:23 AM GitHub64 left the channel.
11:59:49 AM tilgovi judell: I'd like to see that come as a natural consequence of unifying those code paths completely
12:00:15 PM tilgovi there's some interesting query parsing stuff going on, client and server, that can likely be vastly simplified
12:00:35 PM judell so now it's split between python and js?
@judell
judell / gist:7b2dbb1e2d9dcae4eb65
Created March 30, 2015 18:30
h docs minus sphinx directives

HTTP API

This document details the h application's public HTTP API. It is targeted at developers interested in integrating functionality from Hypothesis into their own applications.

root

@judell
judell / gist:3942738dd584e239f091
Created March 31, 2015 13:20
H utils: 1, simple dashboard (users and annotations per day), 2. Atom feed synthesizer for H tag query
import json, urllib2
from feedgen.feed import FeedGenerator
from BaseHTTPServer import BaseHTTPRequestHandler
import urlparse, operator
class GetHandler(BaseHTTPRequestHandler):
def do_GET(self):
if not "method=" in self.path:
Stream:
https://hypothes.is/stream?q=uri:http:%2F%2Farstechnica.com%2Fgaming%2F2015%2F04%2Fvalve-software-co-founder-gabe-newell-becomes-a-video-game-character%2F
Found one result. Clear search.
Sorted by newest
Newest
Oldest
judell on “Valve Software co-founder Gabe…” (arstechnica.com) an hour ago
Valve Software co-founder Gabe Newell becomes a video game character
curl --head -k https://hypothes.is
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 14 Apr 2015 16:36:57 GMT
curl --head -k https://hypothes.is/blog
HTTP/1.1 502 Bad Gateway
Server: nginx
Date: Tue, 14 Apr 2015 16:37:03 GMT
Command "/home/jon/.virtualenvs/h/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-sRqn9q/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vhLhiu-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/jon/.virtualenvs/h/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-build-sRqn9q/cffi
make: *** [deps] Error 1
@judell
judell / gist:b45a77f789dd78a6a527
Last active August 29, 2015 14:19
reset email template
username = 'judell'
link = 'http://hypothes.is/ACTIVATION'
code = '12345'
domain = 'https://hypothes.is'
emailtext = """Hello {username},
Someone requested resetting your password. If it was
you, please reset your password with this reset code:
@judell
judell / gist:a63c392c4b4f64776fb9
Created April 29, 2015 22:34
tag concordance
import json
f = open('c:\\users\\jon\\all_annos.json','r')
s = f.read().decode('utf-8')
j = json.loads(s)
s = ''
all_tags = {}