Better HN
topnewbestaskshowjobs
Log inSign up

mozey

368 karma · joined Apr 21, 2014 (12y ago) · 157 submissions

[ my public key: https://keybase.io/mozey; my proof: https://keybase.io/mozey/sigs/xSF9tMAMKCKz4u2waGjej5krzW2F1NYoUojccHAavIY ]
Submissions

comment 1mo ago · link · parent

> or croweggs

You can totally be friends with a chicken, and still eat chicken eggs, they don't mind. Most chickens have been bred to have little interest in incubating the eggs. Not sure how a crow would react...

Side note, I saved a few Guinea Fowl chicks from the road the other day. When I put them down next to the parents and the other chicks, one of the parents launched at me and tried to claw out my eyes. My eyes survived intact, but I had a few scratches on my ears and arms

2.

Large language models take the original politicalcompass.org test(aipolcom.net ↗)

3 points · by mozey · 2mo ago · discuss

comment 1y ago · link · parent

What is the benefit of writing Go to generate HTML?

1. With go-app

  func (h *hello) Render() app.UI { 
    return app.Div().Body(app.Text(fmt.Sprintf("Hello %s", h.name))) 
  }
2. Compared to using templ

  templ Hello(name string) { 
    <div>Hello, { name }</div> 
  }
For me personally, the latter seems nicer

- I can see at a glance the structure of the HTML

- Completion on the HTML tags, attributes, etc

- Completion on CSS (TailwindCSS LSP for VSCode)

- Logic can still be shared with other types of UIs (e.g. CLI, Native Apps, Webkit, gRPC)

If what you want is option 1, isn't this solution incomplete. That is, the fully realised vision would be a native component / widgets API (e.g. Fyne, QT, GTK), and then generate HTML from the components?

However, "since Dagger Cloud is built as a PWA, it can be installed as a desktop or a mobile application. This makes it possible to launch Dagger Cloud like a native application and get a full-screen experience without needing to open a browser first, or just have a dedicated icon in your desktop taskbar/dock", so it sounds like the "Native App" is using a Webkit (e.g. Wails, Tauri, Electron)

Anyway, congrats on having commercial users building stuff with your project!

comment 2y ago · link · parent

Some people used to have a little putty stuck to the middle their CRTs

comment 2y ago · link · parent

Have to admit I've never used this code, and didn't know what it was about. Quickly read up about it. So ETag is a hash of the resource. You must provide it with requests that modify the resource. If your hash doesn't match the server hash, then 412 Precondition Failed is returned?

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412

https://www.rfc-editor.org/rfc/rfc9110#status.412

comment 2y ago · link · parent

I'm working on a server/backend for htmx that's intended to run as a local service beside the browser. In theory you could do this with any server stack that is self host-able. My goal is to produce a single binary with no external service dependancies. I'm using Go, and a lot of the components are readily available, e.g. self updating local service, replicated database, etc. It's easy to cross-compile for different target OS and architectures. As an alternative to building everything into the browser, and assuming you're able to run a separate process, this approach makes a lot of sense to me. It would be great if Go had something similar to Deno's permission management though...

comment 2y ago · link · parent

Yes it is, compared to gojq https://github.com/itchyny/gojq/blob/main/go.mod

comment 2y ago · link · parent

Been renovating an old house with a large garden for almost ten years now. I tell myself this is better than building something from scratch, but it definitely doesn't always feel more efficient. It helps that I didn't have the option back then, but now maybe I do? Sometimes it's also hard to tell, in the moment, which things to keep and what to rip out.

comment 3y ago · link · parent

Touch typing is something I should've invested in much earlier, can't imagine how I ever coped without this ability. Another thing that really helped me is the "Alternative finger positioning" described here: https://typingsoft.com/typing.htm It feel much more natural not having to bend your wrists. Is anyone else also doing this? Whenever people ask me how to learn touch typing I look for native Linux or macOS app that teach this technique, but I haven't found any yet...

comment 3y ago · link · parent

Actually, just remembered why I haven't used it. Although it "Ships with IDE autocompletion", last time I checked that's only on the Go code, not the HTML. Usually I keep my templates as .html files, and find the IDE autocompletion and linter on the HTML more valuable

comment 3y ago · link · parent

Besides the built-in templates/html, there's also this https://github.com/a-h/templ Haven't used it yet, but seems promising

comment 3y ago · link · parent

I applied for a UK visa from South-Africa about a year ago. To start my application I had to submit a form on this domain. The navigation to the form was obscured by a giant banner about the Ukraine invasion and a message about how service levels might be reduced due to refugees... no matter how I resized my browser window I couldn't get to the part of the page behind the banner. Eventually I opened up the Dev Tools and added some CSS to hide the banner. The link was revealed and I could continue with my application

comment 3y ago · link · parent

CORS policy usually requires that the port must match. This issue potentially applies to all web apps, not only those hosted on localhost

comment 3y ago · link · parent

Last time I checked it's not possible on iOS. On Android it's possible with some effort (e.g. you have to use Termux), not something you could expect a user to setup

comment 3y ago · link · parent

Instead of wrapping the application with something like Electron, why not install as a service and connect to a localhost port using your default browser?

I know this is not the same UX as installing an app. But why isn't this technique more standard?

Besides more efficient resource usage, another benefit is that it keeps the client/server architecture.

comment 3y ago · link · parent

> 5 seconds later, the thing I wanted appears

Is this an intrinsic attribute of all web apps, or specific to an implementation?

comment 3y ago · link · parent

This default behaviour makes sense. If you're going to be using it for hosting in production, then read the documentation, and it's trivial to disable. If I recall, AWS has a similar default for some services. That is, access to the subnet (VPC) gives you full access to the attached service, no password required.

comment 3y ago · link · parent

"This project attempts to push TypeScript's type system to its limits by actually implementing various functions and algorithms, purely on top of the type system... Please note that this project is meant to be used for fun and learning purposes and not for practical use"

comment 3y ago · link · parent

The hx-disable attribute can be used to disable htmx for parts of the DOM that load user generated content, is that what you're referring to? https://htmx.org/docs/#security

comment 3y ago · link · parent

> dynamically loaded modules, error boundaries

In an MPA, modules https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid... can be included on the pages that require them with a script tag. Errors (and new features) are limited to a specific page, and the rest of the site remains unchanged.

> suspense (or another form of components loading their own data)

The htmx lib https://htmx.org/ mostly takes care of this: "gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML". The hx-boost tag can also be used for progressive enhancement.

> as soon as you need the bloat you’re just reinventing a wobbly wheel without one

When building a rich client, using a framework could be productive. For example a photo/video editor app. For a news site and CMS I would probably stick to the approach I've described above.

comment 3y ago · link · parent

> by wrapping a vanilla lib to a component or an action, you’ve essentially created basic Svelte version of that lib

This is the key to making framework churn go away. The DX of using vanilla JavaScript is getting better every day. And is a much better experience than it was a decade ago.

> Islands architecture and partial hydration can help you render static HTML with just a small portion of JavaScript for those components who need it

I'm doing this with Hugo for rendering the static parts, and htmx for loading hydrated partials. The HATEOAS approach simplifies state management in the application. There is no client side "routing", just links and the back button.

In addition to vanilla libs, I include one "app.js" bundle. This file is created with esbuild and linted with deno. My "business logic" can be written in TypeScript in VSCode with the Deno extension and LSP server.

comment 3y ago · link · parent

> which might be scanned under different conditions, such as different light levels and resolutions

This makes me think of your stereotypical pirate map to buried treasure

comment 3y ago · link · parent

> One thing this kind of pattern actually does is expose the conversation to more of YOUR psychology and perspectives. You expose it to more nerves to tickle, let’s say. Or in effect, you are giving the AI more of your brain’s surface area to work on

Conveying and interpreting "mood" correctly is the most difficult part of human to human conversation. It has a huge impact on how efficiently "the message" is communicated.

comment 3y ago · link · parent

The compilation step, and the resulting binary, is also very useful if you need to distribute your software. As opposed to creating a ZIP file.

There are tools for creating stand-alone executables from PHP source code, but they're not as nice to use, compared to languages that were designed for this. By distributing software I also mean making your latest code live in prod.

I suppose the benefit of using PHP (or other interpreted languages) is that it's easier to create "plugins", just copy the new source files to the server.

comment 3y ago · link · parent

Whisky can be incredible harmful and it's just a stronger version of wine... difference is the label clearly states the percentage alcohol

comment 3y ago · link · parent

On earth advancements in technology, education, and especially woman's rights quickly lead to reduced or even negative population growth. So maybe interstellar civilisation won't need that many space cities

comment 3y ago · link · parent

Modules are for organising your code, services are for organising processes on the OS, and micro-services are for organising teams of developers

comment 3y ago · link · parent

I built an example that uses separate select tags for year, month, day, and time.

The benefits of doing this are:

- Standard elements that work everywhere

- Easy to refresh the available options after a date change

- Mimics the "rolodex" behaviour to quickly find any date/time

The libs I used are arbitrary, won't be hard to rewrite using only built-in Javascript, or any library / framework

https://www.mozey.co/demo/ts/examples/datepicker/

123456