Skip to content

Instantly share code, notes, and snippets.

- Inexplicable perversity of human nature.
- The clever machinations of MongoDB's marketing people.
- The AGPL license killed it.
- We spent too long development before monetizing.
- Bad performance.
- Numeric types limited to a 64-bit `float`.
- Great product, but didn't/couldn't translate to revenue.
- Bad business model.
- Failure in timezones/timestamp nuances.
@coffeemug
coffeemug / rethinkdb-import-export.md
Last active January 19, 2023 08:21
Description of import and export feature introduced in RethinkDB 1.7.

You can import data as follows:

# Import a JSON document into table `users` in database `my_db`
$ rethinkdb import -c HOST:PORT -f user_data.json --table my_db.users

# Import a CSV document
$ rethinkdb import -c HOST:PORT -f user_data.csv --format csv --table my_db.users
Nobel Prize
Like a beast in a pen, I'm cut off
From my friends, freedom, the sun,
But the hunters are gaining ground.
I've nowhere else to run.
Dark wood and the bank of a pond,
Trunk of a fallen tree.
There's no way forward, no way back.
It's all up with me.
@coffeemug
coffeemug / rethinkdb-getall.md
Last active March 2, 2022 07:29
Using the `getAll` command to query multiple keys in RethinkDB 1.7.

Querying by multiple keys

The previous releases of RethinkDB allowed querying indexes as follows:

// Three ways to get the user with primary key 5
r.table('users').get(5)
r.table('users').getAll(5)
r.table('users').getAll(5, {index: 'id'})
@coffeemug
coffeemug / gist:6168031
Last active February 3, 2022 23:16
The fun of implementing date support
After spending the better part of the month implementing date support
in RethinkDB, Mike Lucy sent the team the following e-mail. It would
have been funny, if it didn't cause thousands of programmers so much
pain. Read it, laugh, and weep!
-----
So, it turns out that we're only going to support dates between the
year 1400 and the year 10000 (inclusive), because that's what boost
supports.
@coffeemug
coffeemug / yarn.lock
Created December 24, 2021 22:07
jup toArrayLike intermittent error
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/code-frame@7.12.11":
version "7.12.11"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f"
integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==
dependencies:
"@babel/highlight" "^7.10.4"
const trade = async () => {
const params = {
buyToken: 'UNI',
sellToken: 'ETH',
sellAmount: '100000000000000000',
// same failure with slippage commented out
slippagePercentage: 0.2,
}
const res = await axios.get(`https://api.0x.org/swap/v1/quote?${qs.stringify(params)}`);
// Got implicit conversion working the compiler!
// You implement it like this:
enum maybe<T> = none | some(T);
// `T?` is just sugar for `maybe<T>`
impl<T> T? {
// the colon prefix means function is static
fn :from(x: T) -> T? {
fn print<T>(x: T) {
// backticks inject Golang code directly. This isn't
// type-checked or processed by Axler. Any Axler variable
// must be marshalled via `<%=` and `%>`
`fmt.Printf("%v\n", <%= x %> )`
}
enum maybe<T> = none | some(T);
// `T?` is syntax sugar for `maybe<T>`. Just a convenient way
@coffeemug
coffeemug / rethinkdb-atomic-get-set.md
Last active February 2, 2018 15:17
Atomic get and set in RethinkDB 1.7

Suppose you have a number of nodes on a network that spin up cron jobs to perform various tasks. However, you need the nodes to cooperate to ensure that multiple nodes don't spin up the same task. You can easily implement this functionality on top of RethinkDB as follows:

// A single node atomically pushes jobs onto an array in the database
r.table('admin').get('jobs').update({ job_list: r.row('job_list').append(JOB_DESCRIPTION)) })