Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Last active September 7, 2023 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typeoneerror/ce6fe41dd52b879451df2dd9dd301b61 to your computer and use it in GitHub Desktop.
Save typeoneerror/ce6fe41dd52b879451df2dd9dd301b61 to your computer and use it in GitHub Desktop.
Sort a Notion relation by value with highlights
prop("Videos")
.map(current.prop("Views"))
.sort()
.reverse()
.map(
lets(
views,
current,
prop("Videos").find(current.prop("Views") == views)
)
)
.map(
lets(color, index == 0 ? "red" : "",
current + " (" +
current.prop("Views")
.replace("(\d{1})(\d{3})$","$1,$2")
.replace("(\d{1})(\d{3},\d{3})$","$1,$2")
.style("b", color) +
")"
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment