Skip to content

Instantly share code, notes, and snippets.

View inexorabletash's full-sized avatar

Joshua Bell inexorabletash

View GitHub Profile
@inexorabletash
inexorabletash / aliens_map.txt
Last active June 1, 2020 03:06
Aliens: The Computer Game (Activision) - Map
║ ═ ╔ ╗ ╚ ╝ ╠ ╣ ╦ ╩ ╬ -- normal
│ ─ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼ -- infested
Save the Marines:
╔═╦╦═╦╦═╗╔═╦╦═╗
╠╗╠╬═╝╚╦╩╣╔╝╚╗╚╗
║║║╚╗╔╦╝╔╬╝╔═╬═╝
╚╝╚═╩╝╚═╣╚═╣╔╩╦╗
║╔╗║╚╦╝║
@inexorabletash
inexorabletash / @ IndexedDB Full Text Search (Proof of Concept).md
Last active March 19, 2024 13:08
IndexedDB Full Text Search (Proof of Concept)

This demonstrates the implementation of full text search for documents in Indexed DB.

  • Word-breaking and stemming is used to create a list of terms for each document.
  • Document records are annotated with the list of terms when added to the database.
  • A multi-entry index on the list of terms is populated.
  • A query is similarly processed into a list of terms.
  • A join over the terms is implemented using multiple cursors on the index.

The necessity of annotating records with the word list to populate the index is a limitation of the current Indexed DB API. A feature request to support custom

@inexorabletash
inexorabletash / @ Intl.Segmenter polyfill.md
Last active January 5, 2021 17:53
Intl.Segmenter polyfill

Following proposal by @littledan

THIS NO LONGER MATCHES THE PROPOSED API AND SHOULD NOT BE USED

Just proof-of-concept. Do not use in production.

Caveats:

@inexorabletash
inexorabletash / @WHATWG-style logos.md
Last active January 25, 2024 01:07
In another universe...
@inexorabletash
inexorabletash / @ Indexed DB - N-Dimensional Select V2.md
Last active July 18, 2022 11:03
@ Indexed DB - N-Dimensional Selection V2

Indexed DB - N-Dimensional Selection (V2)

This is a redo of the solution over in Indexed DB - N-Dimensional Selection but with a revised "API". The sample here takes a query in the form of an array of IDBKeyRange instances (or null), e.g.

select(index, [IDBKeyRange.bound(5, 7), null, IDBKeyRange.lowerBound(15000)], callback, complete);
@inexorabletash
inexorabletash / @ Indexed DB URLs via Service Workers.md
Last active December 20, 2023 01:29
Indexed DB URLs via Service Workers

URLs into Indexed DB, via Service Workers

Let's say you're using Indexed DB for the offline data store for a catalog. One of the object stores contains product images. Wouldn't it be great if you could just have something like this in your catalog page?

<img src="indexeddb/database/store/id">
@inexorabletash
inexorabletash / @ Indexed DB - N-Dimensional Select.md
Last active April 16, 2024 20:38
Indexed DB - N-dimensional selection

Indexed DB - N-Dimensional Selection

The problem

We have an index with keys of the form:

[ dim1, dim2, dim3, ... ]

e.g. created with:

@inexorabletash
inexorabletash / @ Indexed DB Transactionless API.md
Last active September 23, 2016 16:03
Transactionless IDB API

Transactionless Indexed DB

Status: Initial thought experiment. Feedback welcome.

There are times when Indexed DB's transaction-centric API is too heavyweight:

# Custom prompt
function prompt {
write-host -NoNewLine -ForegroundColor Red $pwd
# Current git branch name
$branch = git rev-parse --abbrev-ref HEAD
if ($branch) {
write-host -NoNewLine -ForegroundColor Green (' [' + $branch + ']')
}
@inexorabletash
inexorabletash / @ Indexed DB Promises.md
Last active September 25, 2015 15:51
Indexed DB + Promises #3