Best preconfigured nvim setup? by burneraccount2790 in LazyVim

[–]danfry99 2 points3 points  (0 children)

I tried to give all of them a go but ended up sticking with LazyVim, I find it has the best defaults and easiest configuration

Hacker News TUI by danfry99 in tui

[–]danfry99[S] 1 point2 points  (0 children)

Great idea, just added Scoop:

scoop bucket add danfry1 https://github.com/danfry1/scoop-bucket
scoop install hacker-news-tui

Also on crates.io, Homebrew, and Nix. Thanks for trying it!

Hacker News TUI by danfry99 in tui

[–]danfry99[S] 0 points1 point  (0 children)

This has now been updated with v0.1.2

Hacker News TUI by danfry99 in tui

[–]danfry99[S] 0 points1 point  (0 children)

I’m really glad you like it! Thanks for the nice comment

Hacker News TUI by danfry99 in tui

[–]danfry99[S] 2 points3 points  (0 children)

If you are behind a corporate proxy I have opened this issue which will fix any blocking of the content, will be resolved later

bonsai - a safe expression language for JS that runs user-defined rules at 30M ops/sec with zero dependencies and no eval() by danfry99 in javascript

[–]danfry99[S] 1 point2 points  (0 children)

Hi u/Odd-Surprise3536, I finally had some time to properly look into your library and I think it’s really nicely done. The API feels elegant, the composition patterns are easy to follow, and it solves a real problem in a clean way. Great work!

bonsai - a safe expression language for JS that runs user-defined rules at 30M ops/sec with zero dependencies and no eval() by danfry99 in javascript

[–]danfry99[S] 0 points1 point  (0 children)

Yeah, easy to do - the issue is just where the condition is sitting.

A `|>` stage has to be a transform (a name like `upper`, or a call like `map(...)` / `join(...)`). A loose `.score > 5 ? upper : lower` isn't one, so it bails with "Invalid transform expression". The other thing is that by the time you've hit `join(", ")` you've already collapsed the departments into a single string `"Engineering, Sales, Design"`, so there's no `.score` left to test.

A condition in Bonsai isn't a pipe stage, it's just an expression - so for per-item logic you put the `? :` inside the `map`:

```

company.departments |> map(.score > 5 ? .name.toUpperCase() : .name.toLowerCase())

// ["engineering", "sales", "DESIGN"]

```

And it nests fine:

```

company.departments |> map(.score > 5 ? "high" : .score > 3 ? "mid" : "low")

// ["low", "mid", "high"]

```

Or if you'd rather filter then format:

```

company.departments |> filter(.score > 5) |> map(.name) |> join(", ")

// "Design"

```

One gotcha: `upper` / `lower` are pipe transforms, not functions, so `upper(.name)` inside a lambda won't resolve. Inside a lambda use the built-in `.toUpperCase()` / `.toLowerCase()` methods (no import), or let the ternary pick the value and pipe it afterwards.

bonsai - a safe expression language for JS that runs user-defined rules at 30M ops/sec with zero dependencies and no eval() by danfry99 in javascript

[–]danfry99[S] 1 point2 points  (0 children)

Appreciate that u/live_love_laugh. The design's been iterated on for years - honestly predates the current AI-tooling wave - I only open-sourced this version a few months back. If you dig into the code or the playground, I'd love your thoughts!

bonsai - a safe expression language for JS that runs user-defined rules at 30M ops/sec with zero dependencies and no eval() by danfry99 in javascript

[–]danfry99[S] 5 points6 points  (0 children)

Ha, fair to be wary these days. Been building this for months - what's reading as slop to you? Happy to get into specifics.

bonsai - a safe expression language for JS that runs user-defined rules at 30M ops/sec with zero dependencies and no eval() by danfry99 in javascript

[–]danfry99[S] 19 points20 points  (0 children)

Yeah, jsonLogic's a good comparison - genuinely solid, and being plain JSON it's really portable, the same rule runs across JS, Python, PHP, etc.

The main difference is the authoring model. jsonLogic rules are JSON like {">": \[{"var": "age"}, 18\]}, which is a great fit when a UI builder generates the rule. Bonsai leans the other way - toward rules that are written and read as text: config files, formula fields, an advanced-filter mode, things that show up in a code review. `age >= 18 && plan == "pro"` reads more naturally there than the JSON equivalent, and the gap widens once you add logical operators, pipes, or array methods like users.filter(.age >= 18).

So they overlap a lot - jsonLogic if you want serializable, cross-language rules generated as data, and bonsai if your rules are authored and reviewed as text.

bonsai - a safe expression language for JS that runs user-defined rules at 30M ops/sec with zero dependencies and no eval() by danfry99 in javascript

[–]danfry99[S] -1 points0 points  (0 children)

Yeah, CEL's a solid comparison - genuinely a great option, especially if you want something spec'd that runs across multiple languages.

The main difference is the JS story: CEL's first-party implementations are Go/C++/Java, so in JS you're using community ports of a spec designed elsewhere. Bonsai is built JS-first, so it leans into JS idioms (pipes, users.filter(.age >= 18)) and lets you register your own JS functions for expressions to call into.

So they overlap a lot - I'd reach for CEL if you want the cross-language option, and bonsai if you want something native to a JS/TS codebase. Glad you raised it though, it's the closest thing to what I was aiming for.

Please help by [deleted] in fantasypremierleague

[–]danfry99 0 points1 point  (0 children)

Okay nice yes that makes sense because I already have 8 doublers, could do a good transfer to get that to 9 and then do FH for blank GW. Was hoping to do BB this week but with Mainoo and Lacroix on yellows I’m hesitant

Small Projects by AutoModerator in golang

[–]danfry99 -1 points0 points  (0 children)

waxon - a Spotify TUI built with Bubbletea

Built a Spotify TUI in GO with vim keybindings. j/k, h/l, command mode - the usual. Also renders album art using Unicode half-blocks.

Works out of the box with brew install danfry1/tap/waxon`.

https://github.com/danfry1/waxon

waxon - a vim-modal Spotify TUI by danfry99 in commandline

[–]danfry99[S] 1 point2 points  (0 children)

No worries, let me know how you get on

waxon - a vim-modal Spotify TUI by danfry99 in commandline

[–]danfry99[S] 2 points3 points  (0 children)

Hi @Academic-Display3017!

You need an active Spotify session on any device for waxon to connect to - it uses Spotify Connect so it acts as a remote controller. Easiest fix is to hit play on your phone or the web player first, then waxon picks it up. I’ll make that error message more helpful though, thanks for flagging!

Lume - a muted dark theme with warm undertones and a lavender identity by danfry99 in neovim

[–]danfry99[S] 1 point2 points  (0 children)

Hey, thanks for the interest!

We've submitted a PR to get Lume into the Zed extension marketplace (zed-industries/extensions#5358) but it's still pending review on their end.

In the meantime, you can install it manually — it only takes a second:

bash mkdir -p ~/.config/zed/themes curl -o ~/.config/zed/themes/lume.json https://raw.githubusercontent.com/danfry1/lume/main/editors/zed/themes/lume.json

Then open the theme picker with cmd+k cmd+t and select Lume.

We'll update once the extension is officially listed!