(C-x means ctrl+x, M-x means alt+x)
I'm going to assume that C-f is your prefix.
\ProvidesPackage{poltakmacros} | |
\RequirePackage[utf8]{inputenc} % Used for correct fromatting of unicode symbol § in output. | |
% Personal macros. | |
\newcommand{\vs}[2]{#1 \emph{vs.}\ #2} | |
\newcommand{\etal}{\emph{et al.}\ } | |
\newcommand{\ie}{\emph{i.e.}\ } | |
\newcommand{\eg}{\emph{e.g.}\ } | |
\newcommand{\sectref}[1]{§\ref{#1}} | |
\newcommand{\figref}[1]{Figure~\ref{#1}} |
function myFunction() { | |
// Constants | |
var SPREADSHEET_URL = 'https://docs.google.com/spreadsheets/d/1T_Wijb2dFYmjEL3yWSETw2yJAvHE04uzDrDLjstVp4Q/edit'; | |
var DATE_COLUMNS = { | |
CHECK_IN: 5, | |
CHECK_OUT: 6, | |
}; | |
// Set up initial objects | |
var ss = SpreadsheetApp.openByUrl(SPREADSHEET_URL); |
set noscalehints | |
set noignorecase |
const mapHistToStorageModel = async transformFn => { | |
const histItems = await browser.history.search({ text: '', maxResults: 9999999, startTime: 0 }) | |
const urls = new Set() | |
const storageItems = [] | |
histItems.forEach(item => { | |
if (urls.has(item.url)) return | |
urls.add(item.url) | |
storageItems.push(transformFn(item)) | |
}) | |
return storageItems |
10:13:37.618 visits time: chunk #1: 275.9130859375ms | |
10:13:37.619 vists for chunk #1: 7501 | |
10:14:39.488 add-to-index time: chunk #1: 61867.76318359375ms | |
10:14:39.661 visits time: chunk #2: 172.335693359375ms | |
10:14:39.662 vists for chunk #2: 1646 | |
10:14:55.930 add-to-index time: chunk #2: 16266.155029296875ms | |
10:14:56.081 visits time: chunk #3: 150.328125ms | |
10:14:56.083 vists for chunk #3: 407 | |
10:15:03.552 add-to-index time: chunk #3: 7468.192138671875ms | |
10:15:03.796 visits time: chunk #4: 243ms |
Time > # imports imported + indexed | |
===================== | |
12:50 > 0 | |
13:00 > 20 | |
13:10 > 80 | |
13:20 > 87 | |
13:30 > 115 | |
13:40 > 120 | |
13:50 > 194 | |
14:00 > 247 |
// Here's an example of a doc which would be indexed in our program; all fields will be defined (arrays may be empty) | |
// Note the `id`, `visits`, and `bookmarks` fields contain IDs taken from our PouchDB DB, that's why they look a bit funny. | |
// The main thing to note about them is the second part is an epoch timestamp (in general: `:type/:timestamp/:nonce`). | |
// PouchDB/CouchDB indexes docs via IDs, hence it's common to derive them from some meaningful data too afford log-time lookups without much effort. | |
const exampleDoc = { | |
id: 'page/1504617273751/8255568509', // `_id` of a "PouchDB" doc from which the main `content` field is derived from | |
content: 'Lots and lots of text, taken from `document.innerHTML` of webpages, with some HTML and text preprocessing done in attempt to slim it down a bit', | |
url: 'gitter.im/fergiemcdowall/search-index', // protocol and 'www.' preprocessed out, to afford weighted query predicate on `domain.tld` patterns | |
visits: ['visit/1504617273700/5363014742', 'visit/1504617273700/5 |