Skip to content

Instantly share code, notes, and snippets.

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)}`);
@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"
@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 / 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'})
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-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
- 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.