Skip to content

Instantly share code, notes, and snippets.

@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/[email protected]":
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)}`);
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.
// 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 / age-of-em-review.markdown
Last active March 7, 2017 11:58
Age of Em Review

Every piece of speculation about the future I've ever encountered broadly pattern-matches into one of four genres: forecasting, prophecy, literary works of fiction, and rants. Age of Em doesn't autocomplete into any of these, and I think both my irritation and fascination with it come from the same source -- the audacity of creating an entirely new genre of futurism.

Here are rough properties of the existing four genres:

  • Forescasting - narrow subject matter, falsifiable details that
### Keybase proof
I hereby claim:
* I am coffeemug on github.
* I am coffeemug (https://keybase.io/coffeemug) on keybase.
* I have a public key whose fingerprint is 61D8 8768 ADF2 C641 6ED5 2E6A 045D F3C7 4618 7048
To claim this, I am signing this object:
- 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.

Keybase proof

I hereby claim:

  • I am coffeemug on github.
  • I am coffeemug (https://keybase.io/coffeemug) on keybase.
  • I have a public key whose fingerprint is 5925 55F9 CC4C 2D4E E82E 97AA A33E 7D8E 5279 41E9

To claim this, I am signing this object:

@coffeemug
coffeemug / hn_rethink
Created October 7, 2014 19:08
Grab top stories into RethinkDB via Hacker News API
r.http("https://hacker-news.firebaseio.com/v0/topstories.json").limit(5).map(
r.http(r.add("https://hacker-news.firebaseio.com/v0/item/",
r.row.coerceTo('string'),
".json"))
);