tomhallett | 2 years ago | on: SQLPage – Building a full web application with nothing but SQL queries [video]
tomhallett's comments
tomhallett | 2 years ago | on: Bruno: Fast and Git-friendly open-source API client (Postman alternative)
tomhallett | 2 years ago | on: Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby
tomhallett | 2 years ago | on: Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby
1) X-Alpine-Target
``` <form method="post" action="/comments" x-target="comments comments_count" ```
generates an ajax request with this header by default:
``` X-Alpine-Target: comments comments_count ```
This is very very cool! In most usecases, one the serverside I can return a full html document and alpine-ajax will only look for #comments and #comments_count in the response. BUT, if I want the serverside to be faster (ie: do less), then the client is able to tell the server which parts of the html it wants via the `X-Alpine-Target` header -- instead of the server having to know which parts need updating via the url alone. It's like graphql for the htmx/hotwire architecture.
2) `ajax:missing`. If the client expects dom ids to be in the response and they aren't there, you can create a sentry error to expose the broken "contract" between the initial page's request and the action's response.
3) x-merge="append"
In hotwire, the html markup is dumb and the turbo-stream response is smart (`turbo-stream action="append"`). But in alpine-ajax, the response is dumb and the html markup is smart (`x-merge="append">`). This difference is subtle, but it allows for the serverside responses (for actions) be more general purpose/discrete components, while the ux which might change from page-to-page or section-to-section is decoupled to that page's/section's container html.
4) x-sync
"Elements with the x-sync attribute are updated whenever the server sends a matching element, even if the element isn't targeted with x-target."
Wow - amazing developer ux for cross cutting concerns like notifications, flash messages, etc. So practical.
5) Creating demos with an alpine-ajax mock server.... wow, an out of the box way to make standalone component test pages.
tomhallett | 2 years ago | on: Show HN: Alpine Ajax – If Htmx and Alpine.js Had a Baby
Looks very interesting!
Also loved the comparisons, especially with rails/turbo and the downsides of custom elements wrt tables.
tomhallett | 2 years ago | on: CAP twelve years later: How the "rules" have changed (2012)
tomhallett | 2 years ago | on: Htmx and Web Components: A Perfect Match
tomhallett | 2 years ago | on: RawJS is a better way to call document.createElement()
tomhallett | 2 years ago | on: Build your own WebAssembly Compiler (2019)
The frontend masters course by Jem Young was really good as well. https://frontendmasters.com/courses/web-assembly/
tomhallett | 2 years ago | on: OpenAI's employees were given two explanations for why Sam Altman was fired
Note: I’m not making a moral claim one way or the other, and I do agree that most tech companies will grow to a size/power/monopoly that their incentives will deviate from the “common good”. Are there examples of openai’s structure working correctly with other companies?
tomhallett | 2 years ago | on: Monaspace
If the editor “repaints” commit mono on the letter-pair boundary, I could see that being a very jumpy UX — ie: the letter I just typed is moving by a few pixels. But if that repaint happens on the word boundary it might be less noticeable?
In either case, a transition could be helpful for commit mono and/or Monaspace. (But agreed with above comments that Monaspace is more subtle because it spreads the spacing over the entire word, so maybe the transition is not actually percievable or worth it). :)
tomhallett | 2 years ago | on: Build a Lightweight Code Generator with TypeScript and JSON Imports
* Person A [Marketer who knows html/handlebars] logs into Postmark and makes a new email template.
* Person A tells Person B [node js developer], "Please send the new 'welcome' email template from the app".
* Person B runs the cli script, so the json file now has a template with a key of 'welcome-template-2023-blue'.
* Person B can write/modify any code which calls "sendEmailTemplate" and know exactly what code is valid, wont compile, etc.
They are "generating" the "class/object/type definitions" programmatically - which seems fine to me for the code generation problem they lay out.
Which part is not "a valid case" to you?
Note: the fact that the article is "typescript + json" versus pure "typescript" doesn't seem like a important distinction with respect to it be valid code generation, not sure if others disagree.
Random note: A different way to solve this problem would be with the "cog" python module [1], but that would come with a different set of tradeoffs. :)
tomhallett | 2 years ago | on: Failing Startup Confessions
tomhallett | 2 years ago | on: WasmGC – Run GC languages such as Kotlin, Java in Chrome browser
* user "menaerus" goal is have "C/C++/Rust developer [...] expose your product as a browser service", which they can transpile to wasm - cool.
* they will need "a bit of JavaScript you integrate it into the end service" - UI targets the DOM, sounds great.
The questions become:
* how much code will need to be written into each layer (rust wasm, react html ui, bridge between the 2)?
* what level of experience with that tech will you need todo that? ie: writing a react ui which interfaces with a wasm shim is some non-trivial javascript to say the least.
* based on the above: how far has wasm enabled a "c/c++/rust developer" to easily port their application to the web without also being a super strong frontend developer?
I'm trying to draw a contrast between:
A) I have business logic which is not well suited for javascript (image processing on binary data, figma, etc), and I have rust/c++ developers AND javascript frontend developers to build the application
B) I am a rust/c++ developer who wants to target the web with their rust/c++ product, but doesn't want to dive deep into frontend/js/react tech.
In the long term, I am optimistic that scenarios like "B" will be opened up by application (web) frameworks which target wasm via backend technologies and their MVC patterns. But in the short term, the amount of "glue code" to be written is non-trivial.
tomhallett | 2 years ago | on: WasmGC – Run GC languages such as Kotlin, Java in Chrome browser
If your application is built upon a web framework which already has this translation layer, like Blazor, then the amount of harness/shim-glue code you need to write goes down.
tomhallett | 2 years ago | on: Show HN: DoltgreSQL – Version-Controlled DB, Like Git and PostgreSQL had a baby
tomhallett | 2 years ago | on: How to Fetch a Turbo Stream
tomhallett | 2 years ago | on: Don't use DISTINCT as a "join-fixer"
The one book I’ve found and really enjoyed was “SQL Performance Explained”.
tomhallett | 2 years ago | on: Calif. passes strongest right-to-repair bill yet, requiring 7 years of parts
* Sony produces semi-conductors and movies (Sony Pictures, Columbia, Tristar)
* Microsoft is big in enterprise cloud (ie: government)
* the impact of people being forced to upgrade their phone because they can't fix it, is probably larger than people being forced to upgrade their game system because they can't fix it
Note: I 100% agree with you. I see video games as the same as all other consumer electronics which were included, but I can see if Sony/Microsoft came complaining, it's a good bargaining chip/favor for other initiatives.
tomhallett | 2 years ago | on: My Node.js is a bit Rusty
BUT, what I am interested in - if I'm using javascript to parse a large file line by line, plucking off specific fields like the example does, what can I try to see if it's more GC-friendly? Obviously the answer is always some flavor of "profile it" and "it depends". If the blog author could have gotten a big boost in performance by adding 10 lines of js code to their loop, that is something all readers of the article could benefit from.
I will play around with it and see what I can learn about the V8 GC. For reference: here is a talk about profiling the ruby gc, which helped me fix a memory leak at work (https://www.youtube.com/watch?v=kZcqyuPeDao).
``` select 'checkbox' as component, 'Terms and conditions' as label, true as required; ```
I'm thinking "What would the workflow of a sql-enthusiast be, to build that page".
I think they'd want todo this first:
``` select * from sqlpage.components; ```
which would list the `name` of each component. Which then takes me to:
``` INSERT INTO sqlpage.dom SET name = 'checkbox', label = 'Terms and conditions ', required = TRUE FROM sqlpage.components ```
(or VALUES syntax for INSERT)
This would allow you to re-order your dom, update dom entries, etc. Very similar to jsx, but instead of jsx creating in-memory javascript objects, it's sqlpage's sql creating rows in a postgres table. Then the SQLPage virtualdom gets transformed into actual html.
Just a thought, :)