今日已更新 218 条资讯 | 累计 31896 条内容
关于我们

今日精选

HOT

最新资讯

共 31896 篇
第 1124/1595 页
AI 资讯 Dev.to

The Code AI Won't Write

I use a form validation problem as a technical interview question. It's deceptively simple — and the solutions people reach for reveal a lot about how they think. Then I tried it on Claude, ChatGPT, and Gemini. The results were illuminating, but not for the reasons I expected. The Problem Many form libraries share a common convention: form data is represented as a plain nested object, and the validation function returns an object of the same shape containing the errors. You'll find this pattern in Formik and React Final Form in React, and — full disclosure — in Inglorious Web , my own framework, which ships form handling built in without any extra dependencies. const values = { productName : ' VR Visor ' , quantity : 1 , homeAddress : { street : ' Long St ' , zip : ' 00666 ' }, shippingAddress : { street : ' Short St ' , zip : ' 00777 ' , co : ' Inglorious Coderz ' }, billingAddress : { street : ' Wide Plaza ' , zip : ' 00888 ' , vat : ' 1142042 ' }, } The validation function should return an object containing all errors found. A starting example: function validate ( values ) { const errors = {} if ( ! values . productName ) { errors . productName = ' required ' } return errors } The ask: extend this to validate every field . Notice that the three address types aren't identical. shippingAddress requires a co field. billingAddress requires a vat . These differences matter — and how you handle them reveals a lot. Four Solutions, Four Instincts 1. The Flag — the average human The most common approach I see in interviews is a single validateAddress function with a type parameter: function validateAddress ( values = {}, type ) { const errors = {} if ( ! values . street ) errors . street = ' required ' if ( ! values . zip ) errors . zip = ' required ' if ( type === ' shipping ' && ! values . co ) errors . co = ' required ' if ( type === ' billing ' && ! values . vat ) errors . vat = ' required ' return errors } It works. But every new address type, every new special rule,

Matteo Antony Mistretta 2026-06-16 20:30 9 原文
AI 资讯 Dev.to

Same Prompt, Four AI Tools, One Cricket Banner: ChatGPT Won the Image, Grok Won the Video, and Claude Built a Website Again

TL;DR — A few weeks ago I tested four AI tools on a build job: a website for my son's cricket academy. This time the job had nothing to do with code. The coach just wanted a banner he could post. Same four tools, totally different result. ChatGPT made the best image, Grok made the best video, Gemini wouldn't make anything, and Claude tried to solve a graphics problem by writing HTML. If you read the last post , you've met my son's cricket coach. He runs MMCA — Maverick Master's Cricket Academy. Started in 2020, based in Bengaluru, genuinely good with the kids. The website is live now and parents have started messaging him on WhatsApp. So last weekend he came back with the next thing he needed, which is the thing every small academy actually runs on: "Can you make me a weekend batch banner? Something I can post in the parent groups." Now, this is a completely different job from the last one. That first experiment was design and development — agents writing real code, running tests, deploying to Cloudflare. This one is just graphics. No repo, no deploy, nobody reviewing a pull request. Just: here's my logo, here's a sample I like, make me something I'd be happy to send out. So I figured I'd run the same four tools again and see what happened. Same brief, same logo, everything on the default model with no special settings : ChatGPT, Claude, Gemini, Grok. Here's roughly what I typed, the way a normal client would brief you: Similar to this banner, make one for MMCA Academy (since 2020, logo attached). Weekend batch Sat 4:30—7, Sun 7—9:30pm. Add a small phrase like the sample. Be creative, keep it simple, but don't copy the sample exactly. The whole test really came down to one instruction: be creative, but don't copy. Whatever each tool did with that told me everything. Round 1: the static banner ChatGPT got it on the first go. "WEEKEND BATCH. TRAIN. PLAY. GROW." Logo top-left, the "Since 2020" bit kept, timings in clean little cards, an enrol number, three badges acros

arun rajkumar 2026-06-16 20:30 8 原文
AI 资讯 Dev.to

Focus Issues and Refinement Support

Prologue A while ago, I decided to develop a fully accessible main navigation component in React and write a series of articles documenting the steps it took to create a non-trivial accessible component. My last development article completed the base requirements for keyboard functionality within the component; attention now shifts to adding some of the last functionality required, closing sublists when the lists holding them now close and determining what happens when a closed component is entered via the keyboard through the Tab and Shift+Tab keys. Note : This article is one of a series demonstrating building a React navigational component from scratch while considering accessibility through the process. The articles are accompanied by a GitHub repository with releases tied to one or more articles; each builds on the previous one until a fully implemented navigation component is complete. Each release and its associated tag contain fully runnable code for the article. The code discussed in this article is available in the release. and may be downloaded at release 0.8.0 . Links in the article will take you to the proper file in the tagged GitHub Repository. Because the code for this release is scattered, line numbers are added to make it easier to locate in the linked GitHub file. Line numbers are also provided for those who would like to follow along with a downloaded copy. While code examples are written in JavaScript for brevity, all actual code is written in Typescript and targets React 19.x, all while using vanilla CSS. Examples use Next.js v16.x, which is not required to run the navigation component. You can view the requirements for the Focus and Refinement Support Release along with previous requirements. Content Links Introduction Acceptance Criteria Entering Closings Setting Up For Success Introduction The implementation of keyboard handling left one obvious keyboard issue to fix: an apparent keyboard trap that occurs when focus shifts into the component

ShaynaProductions 2026-06-16 20:30 10 原文
AI 资讯 HackerNews

Show HN: Spin Lab

Hey HN, I built Spin Lab: a browser-based interactive explainer for table-tennis spin. It visualizes topspin/backspin, spin rate, ball trajectory, bounce behavior, and why the opponent’s return reacts the way it does. I built it because spin is central to table tennis, but most explanations are either too hand-wavy or too static. Thanks Fable, we miss you

srijanshukla18 2026-06-16 20:16 4 原文
AI 资讯 The Verge AI

Apple’s smart home camera service is starting to impress me

Apple's HomeKit Secure Video service is getting in on the Apple Intelligence party to bring more descriptive alerts from your connected cameras and let you search footage using natural language. The Apple Home app is also getting better notifications powered by AI and is finally adding support for energy reporting. These improvements were announced at […]

Jennifer Pattison Tuohy 2026-06-16 20:00 10 原文
AI 资讯 The Verge AI

SpaceX is officially buying Cursor for $60 billion

Days after its massive IPO, SpaceX says it is spending $60 billion to buy Cursor - a bet designed to help Elon Musk's sprawling rocket / AI / social media behemoth win over lucrative enterprise customers and close the gap with AI rivals like Anthropic and OpenAI. The takeover was not entirely unexpected: SpaceX announced […]

Robert Hart 2026-06-16 19:41 9 原文
AI 资讯 The Verge AI

Apple’s weird anti-nausea dots cured my car sickness

I'll just work from the car, I thought. But after a few minutes of staring at my screen on quick mountain switchbacks I could feel the first signs of cold, coagulated nausea bubbling up from that sweaty place in my gut. I looked to the horizon for relief, but nothing helped… until I remembered Apple's […]

Thomas Ricker 2026-06-16 19:30 8 原文