| ▲ | varenc a day ago | |||||||
TIL that
is valid JS and calls `js_func` as a tagged template literal, passing it a TemplateStringsArray. Going to use "console.log`weeee`" in my code now. | ||||||||
| ▲ | jsheard a day ago | parent | next [-] | |||||||
It's not common but few libraries use that to support JSX-like syntax at runtime, without a build step. e.g. https://github.com/developit/htm and https://lit.dev/docs/components/rendering/ | ||||||||
| ▲ | Lerc a day ago | parent | prev | next [-] | |||||||
I recently used the feature in a code embedded image generator so I could have compact images store tiny images in inline code. https://gisthost.github.io/?8d537c4a3b2331e7c6c45d31f1900330 The Trashcan in that sampler is stored as
decoded to a SVG D path by
which can be turned into an image by
The Sampler contains all of the images in the html file and still comes out to be only 13k. Probably quite a bit less if you removed the ray tracer and scenes. | ||||||||
| ||||||||
| ▲ | rriley a day ago | parent | prev [-] | |||||||
Niiice! I finally understand the origin of this JS syntax used in SQL queries and GraphQL: sql`SELECT * FROM users WHERE id = ${userId}` const q = gql` query GetUser { user(id: ${userId}) { name email } } `; | ||||||||
| ||||||||