Skip to content

Instantly share code, notes, and snippets.

View BigBlueHat's full-sized avatar
🎩
building Web things

BigBlueHat BigBlueHat

🎩
building Web things
View GitHub Profile
@BigBlueHat
BigBlueHat / gist:11144543
Last active August 29, 2015 14:00
aspen.io test failures on Windows
Ignoring indexes: https://pypi.python.org/simple/
Requirement already satisfied (use --upgrade to upgrade): coverage>=3.7.1 in c:\users\benjamin\documents\github\aspen-python\env\lib\site-packages
Cleaning up...
env\Scripts\pip.exe install --no-index --find-links=./vendor/test coverage>=3.7.1
Ignoring indexes: https://pypi.python.org/simple/
Requirement already satisfied (use --upgrade to upgrade): cov-core>=1.7 in c:\users\benjamin\documents\github\aspen-python\env\lib\site-packages
Cleaning up...
env\Scripts\pip.exe install --no-index --find-links=./vendor/test cov-core>=1.7
Ignoring indexes: https://pypi.python.org/simple/
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.20 in c:\users\benjamin\documents\github\aspen-python\env\lib\site-packages
@BigBlueHat
BigBlueHat / data-and-template.js
Last active August 29, 2015 14:01
Mustache "tree" navigation for year + months
data = {"years":{"rows": [{"value": 3047, "key": [2014], "year": 2014}, {"months": {"rows": [{"value": 554, "key": [2013, 12], "month": 12}, {"value": 467, "key": [2013, 11], "month": 11}, {"value": 503, "key": [2013, 10], "month": 10}, {"value": 241, "key": [2013, 9], "month": 9}, {"value": 428, "key": [2013, 8], "month": 8}, {"value": 442, "key": [2013, 7], "month": 7}, {"value": 434, "key": [2013, 6], "month": 6}, {"value": 730, "key": [2013, 5], "month": 5}, {"value": 456, "key": [2013, 4], "month": 4}, {"value": 1118, "key": [2013, 3], "month": 3}, {"value": 387, "key": [2013, 2], "month": 2}, {"value": 489, "key": [2013, 1], "month": 1}]}, "value": 6249, "key": [2013], "year": 2013}, {"value": 4407, "key": [2012], "year": 2012}]}};
template = '{{#years}}<ul> {{#rows}} <li><a href="/{{year}}/?q={{#qs}}{{q}}{{/qs}}">{{year}}</a> ({{value}}) {{^months}} - no months {{/months}}{{> months}} </li> {{/rows}}</ul>{{/years}}';
months = '{{#months}}<ul> {{#rows}} <li><a href="/{{year}}/{{month}}/?q={{#
@BigBlueHat
BigBlueHat / annotatorjs.schema.json
Last active August 29, 2015 14:04
AnnotatorJS JSON Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://annotatorjs.org/schema.json#",
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"annotator_schema_version": {
@BigBlueHat
BigBlueHat / main.js
Created August 7, 2014 14:36
Firefox Add-on Tab Events
var tabs = require('sdk/tabs');
function onOpen(tab) {
console.log(tab.url + " is open");
tab.on("ready", function() {console.log(tab.url + " is ready")});
tab.on("loaded", function() {console.log(tab.url + " is loaded")});
tab.on("pageshow", function() {console.log(tab.url + " is pageshown")});
tab.on("activate", function() {console.log(tab.url + " is activate")});
tab.on("deactivate", function() {console.log(tab.url + " is deactivate")});
tab.on("close", function() {console.log(tab.url + " is close")});
@BigBlueHat
BigBlueHat / index.js
Last active August 29, 2015 14:06
Hypothes.is JSON key removal tests / validator - requirebin sketch
// existence "tests" for
// https://github.com/hypothesis/h/issues/1207
// using
// https://hypothes.is/api/annotations/KLUGtTMjTUSOPVvACd-dNA
// for reference.
var pointer = require('json-pointer');
var obj =
{
@BigBlueHat
BigBlueHat / index.js
Last active August 29, 2015 14:07
Open Annotation RDFa built from Hypothes.is JSON
/**
* @copyright 2014 The Hypothes.is Project
* @license MIT
* @author BigBlueHat <bigbluehat@hypothes.is>
**/
var mustache = require('mustache');
var request = require('superagent');
var style = '<style>\n\
aside {border: 1px solid darkgray;margin: 2em;padding:1em;background: #efefef;}\n\
@BigBlueHat
BigBlueHat / index.js
Created February 5, 2015 23:35
github contributors history
var request = require('superagent');
var PouchDB = require('pouchdb');
var db = new PouchDB('github-hypothesis');
request
.get('https://api.github.com/repos/hypothesis/h/stats/contributors')
.end(function(res) {
if (res.ok) {
console.log(res.body);
}
@BigBlueHat
BigBlueHat / couchdb-architecture.md
Created February 6, 2015 19:42
TL;DR of CouchDB 2.0 Architecture

Originally composed as IRC messages by the venerable rnewson.

In Apache CouchDB 2.0, there's no such notion of committed. It's AP not CP.

What happens is a write is applied to N nodes (default is 3) and a 201 response is returned when the first W nodes (default is 2) respond with success. A 202 response is sent if < W writes (but > 0) were made. Every node, on receiving an update, does an automatic replication to the others (using an internal, faster, system than _replicate).

Documents are read from N nodes that hold a copy, and a 200 response is sent (and the document) when the first R nodes respond with the same revision.

@BigBlueHat
BigBlueHat / log
Created February 10, 2015 19:30
h login error happening on 066258b
2015-02-10 14:29:35,567 [21607] [h.views:ERROR] Uncaught exception generating response.
Traceback (most recent call last):
File "/Users/byoung/dev/hypothesis/h/lib/python2.7/site-packages/pyramid/tweens.py", line 21, in excview_tween
response = handler(request)
File "/Users/byoung/dev/hypothesis/h/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 92, in tm_tween
reraise(*exc_info)
File "/Users/byoung/dev/hypothesis/h/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 73, in tm_tween
response = handler(request)
File "/Users/byoung/dev/hypothesis/h/lib/python2.7/site-packages/pyramid/router.py", line 163, in handle_request
response = view_callable(context, request)
@BigBlueHat
BigBlueHat / README.md
Last active August 29, 2015 14:16
Test CSV - README is empty

README is empty