Stream of Consciousness
Why I Created This Page
I sometimes want to note something or write something down for the future, but the thing that I want to write about is not long enough to warrant writing a full notes page on. This page is designed to be a microblogging page where I can insert custom HTML/CSS/JavaScript or a lexical editor.
View Stream Options
I wish you could change the theme of vscode depending on what kind of file you were looking at
Car Shipping Cost
The average cost for auto shipping within the continental US is around 1,000 USD, with the lowest flirting near 700-750 USD and the highest average price being in the 1,200-1,300 USD neighborhood. In general, the per-mile average for automobile shipping is around 0.60 USD/mile for distances over 1,000 miles. Shorter routes cost more per mile.
American Auto Shipping -How Much Does it Cost to Ship a Car
From | To | Miles | Cost |
---|---|---|---|
Birmingham, AL | Los Angeles, CA | 2,038 | $1,222 |
New York, NY | Los Angeles, CA | 2,789 | $1,673 |
Miami, FL | Seattle, WA | 3,301 | $1,980 |
Birmingham , AL | San Francisco, CA | 2,326 | $1,395 |
Car Depreciation
- Driving the car off of the lot generally results in about 10% depreciation.
- After that fast initial drop the depreciation progresses a bit more slowly - often by about 10 to 15 percent per year. According to some experts, mileage depreciation is about $0.08 a mile, but depreciation is more commonly measured in years than miles.
Foreign Keys Reminder
A foreign key constraint specifies that the values in a column (or a group of columns) must match the values appearing in some row of another table. We say this maintains the referential integrity between two related tables.
PostgreSQL Docs
- You need to add
ON DELETE CASCADE
when you want the referencing row to be deleted when the referenced row is deleted. - If the two tables are independent, then you can add
ON DELETE RESTRICT
orON DELETE NO ACTION
Creating Search Reference
- Create a table to hold what you want to search.
- Add a
document
column (the column which holds thetext
that you want to search for). - Add a column
search tsvector GENERATED ALWAYS AS (to_tsvector('english',document) || ' ') STORED NOT NULL
- Add a column for embedding if you want to include embeddings.
CREATE TABLE <search_table> (
...
document TEXT NOT NULL,
search tsvector GENERATED ALWAYS AS (
to_tsvector('english',document) || ' '
) STORED NOT NULL,
embedding vector(1536) NOT NULL, -- number inside vector() should be the length of the vector
...
);
Creating Indexes
- To create an index for string similarity matching on the
document
column, use aGIST
index orGIN
index - these are recommended by pgtrm - To create an index for the search column, add a GIN index to speed up searches.
- To create an index for the embedding column, add a
hnsw
index for the embedding column. - The
<option>
below can either be: vector_ip_ops
: Inner Productvector_cosine_ops
: Cosine Distancevector_l1_ops
: L1 Distancebit_hamming_ops
: Hamming Distancebit_jaccard_ops
: Jaccard Distance
- The
CREATE INDEX text_sim_index ON <search_table> USING GIST (document);
CREATE INDEX search_index ON <search_table> USING GIN (search);
CREATE INDEX embedding_index ON <search_table> USING hnsw (<embedding_column_name> <option>);
Lexical Reminder
How Lexical copies Lexical Nodes:
- Copy:
copyToClipboard
: Lexical content serialized with$getLexicalContent
- Paste:
$insertDataTransferForRichText
: if theDataTransfer
data hasapplication/x-lexical-editor
data, then that data isJSON.parse
d, nodes are generated with$generateNodesFromSerializedNodes
, and inserted with$insertGeneratedNodes
You should only use <output for="" />
, with the for attribute, when you want the value of the <input> to be placed into the output element. This can cause problems.
PostgreSQL
- When you add a
FOREIGN KEY
, make sure that you includeON DELETE CASCADE
if you intend the row in the child table to be deleted when the referenced row is deleted.
CSS Reminder
- Whenever using
position: sticky
, you probably need to increase thez-index
of the component and setopacity: 1
so that the sticky content is not partially covered up by content on the page.
Test Stream Consciousness Post with Custom HTML
Enter a modulo divided and dividend in the inputs below and click submit to calculate the modulus.
Test Stream of Consciousness Post with Lexical Editor
There are no more stream of consciousness posts to show.