Skip to content

Instantly share code, notes, and snippets.

@jasonphillips
jasonphillips / getPage.js
Last active August 31, 2015 22:01
Algorithm for finding shortest page for fetching results, given low and high index
/*
* Find smallest page and per_page limit to retrieve a range of results, given low and high
* For non-offset pased paging APIs (where one must send 'per_page' and 'page', rather than offset and limit)
*
* params:
* (integer) low: lowest index to fetch (zero-based)
* (integer) high: highest index to fetch (zero-based)
*
* return value:
* [(integer) per_page, (integer) page]
@jasonphillips
jasonphillips / gist:503ca8cd89dcbb4b551d
Last active August 29, 2015 14:16
Web Document Editor Spec: WIP

Web Document Editor Spec (WIP)

Context and Overview

Across a number of our projects in recent years, we have discerned a growing need for an online editor that can span the gulf between less structured or narrative documents and structured or templated forms. Note that these opposed terms are meant to be intelligible to the non-programmer, and interpreted in that light; "document" here does not refer to document-based non-relational storage or any other technical implementation.

Documents, in user perspective

A document refers to a linear body of formatted text, ie. the object one would author in any word-processing application (Word, Google Docs,...). Its contents are at least implicitly and historically organized around the metaphor of a paper document, with the structure of information built around formatting requirements of sections, paragaphs, headers, and so forth. A document is a singular and complete entity, in "one file" so to speak.