Advertisement Β· 728 Γ— 90

Posts by Marnix Janssen

Next.js works quite well with this setup tbh. Using the middleware and the route.ts routes that it offers, a lot of code that should be handled server-side, is handled server side.

1 year ago 2 0 0 0

Mostly CSR, but all authentication stuff is handled server-side. Building dynamic dashboards is quite difficult using SSR.

1 year ago 1 0 1 0

Appreciate the plug for Advent of Typescript @tkdodo.eu πŸ‘

1 year ago 3 0 0 0
screenshot of zed editor, somehow both calming and vibrant, mmm

screenshot of zed editor, somehow both calming and vibrant, mmm

@zed.dev is so beautiful, a vibe

1 year ago 560 13 54 6

This is nice! I like the fact that queries are defined in a separate queries directory

1 year ago 0 0 0 0

eg.

- /data/queries/user.ts

import { queryOptions } form '@tanstack/react-query'

export const getPosts = queryOptions({
queryKey: ['posts'],
queryFn: getPosts,
})

- /components/feed.tsx

import { getPosts } from '/data/queries/user.ts'

const { data: posts } = useQuery(getPosts)

1 year ago 7 0 2 0

Defining your #reactquery queries with queryOptions is probably the easiest way to keep your growing application maintainable

1 year ago 2 0 2 0
A diagram shows how to use str.split, list.first / list.last, cast, pl.int_ranges, and explode, all together, to turn a dataframe where a column may contain ranges like "3-5" into a similar dataframe where all ranges have been expanded, or exploded, across multiple rows.

The full code is:

range_start = pl.col("nrs").str.split("-").list.first().cast(pl.Int64)
range_end = pl.col("nrs").str.split("-").list.last().cast(pl.Int64)
df.with_columns(pl.int_ranges(range_start, range_end + 1)).explode("nrs")

A diagram shows how to use str.split, list.first / list.last, cast, pl.int_ranges, and explode, all together, to turn a dataframe where a column may contain ranges like "3-5" into a similar dataframe where all ranges have been expanded, or exploded, across multiple rows. The full code is: range_start = pl.col("nrs").str.split("-").list.first().cast(pl.Int64) range_end = pl.col("nrs").str.split("-").list.last().cast(pl.Int64) df.with_columns(pl.int_ranges(range_start, range_end + 1)).explode("nrs")

How to β€œexpand” ranges like "3-5" across new rows with the values 3, 4, 5?

This comes straight from our Discord server (discord.com/invite/4UfP5...)

1 year ago 7 2 0 0
Advertisement
Diagram showing how `value_counts` produces a column with struct values, mapping column values to their counts.
We then show how to use `.struct.field` to extract a single field from the struct and how to use `.struct.unnest` to extract all fields into corresponding columns.

Diagram showing how `value_counts` produces a column with struct values, mapping column values to their counts. We then show how to use `.struct.field` to extract a single field from the struct and how to use `.struct.unnest` to extract all fields into corresponding columns.

Why is there a `struct` data type?

A single expression produces a single column, so expressions like `value_counts` need to output structs to map the values to their counts.

With that said, do you understand why `.struct.unnest` doesn't break the 1 expr = 1 column principle?

1 year ago 7 2 0 0

A while ago I built my first OS project in Rust: a Telegram bot. It shares filterable deals subscribers. As of now, the bot shared over 1.2 million deals to subscribers, using only a Redis DB, without a second of downtime (thanks for hosting @glenndehaan.com πŸ‘)

github.com/mjanssen/pep...

1 year ago 2 0 0 0
Preview
GitHub - aidenybai/react-scan: Scan for React performance issues and eliminate slow renders in your app Scan for React performance issues and eliminate slow renders in your app - aidenybai/react-scan

first post, i came here to say i made a thing today:

github.com/aidenybai/re...

1 year ago 85 10 8 3

@tannerlinsley.com What would/should stop me from migrating our (still) relatively small Next.js frontend to @tanstack.com Start?

1 year ago 1 0 1 0

πŸ‘‹

1 year ago 0 0 0 0