HNHacker News
TopNewBestAskShowJobs

ricksharp

256 karma · joined June 15, 2017

https://ricklove.me
submissionscomments
ricksharp··on How I built a modern website in 2021
I love my overengineered web site / playground. Yes, I hid a text adventure in the site header. Yes, it is full of stuff that no-one will care about. It's my art and my passion.

I put all my cool code there and I over engineer it to death. It's awesome - it's fun - it's what you should do if you love coding. Guess what - I also have a table full of electronic projects, I've made unfinished games, I've done hackathons, it's great and we should embrace that.

Perhaps Kent Dobbs likes experimenting with new technology and trying new stuff. Perhaps his own personal web site is a place where he can do whatever he wants.

If you criticize him for that... well let's just say, I doubt your ability to code - and you are banned from my nerd club. If you don't take joy in an overengineered personal web site - then you are doing it wrong.

Seriously, speed runners spend months trying to save milliseconds on a mario speed run and you want to whine about a software engineer taking joy in his craft...

Ok, that's my rant.

I support freedom, I support the free web, I support the proliferation of code and over-engineered solutions.

ricksharp··on Nuclear weapons agency breached amid massive cyber onslaught
Everyone calm down:

It was just a kid trying to hack into a video game company. He accidentally started a war simulation. The US had recently turned over control of its entire nuclear arsenal to an AI because humans resisted launching weapons that would kill millions.

Anyway, the kid accidentally started a war simulation and now the AI wants to nuke everyone. Don’t worry though, as soon as the AI plays itself in tic-tac-toe, it will realize that peace is the only way.

If you aren’t old enough to understand this, you need to catch up on your 80s nerd movies. :)

ricksharp··on Git is too hard
I use vscode with Git Graph. It gives me a clear understanding of everything, allows me to manage branches easily, gives me access to every command I need, and even allows a great diff view between any commits.

Merge conflicts are easy to solve now and I never get lost in the complexity.

I use cli tools for almost everything, but Git Graph and vscode solves git for me. The only command I run in git cli is git clone or git unit.

ricksharp··on Algebraic Effects for React Developers
Everybody makes state management hard.

All you need is a simple layer to make your typed api calls.

export const ApiService = {

  return {
    getSomeStuff: async () => ...,
    postSomething: ...,
    etc,
  };
}
ricksharp··on Algebraic Effects for React Developers
I’ve been using hooks for a year, and they are awesome (once you get used to it). I can write the same component in 1/3 of the code in a functional style.

The debugging story isn’t great if you expect to be able to use breakpoints.

It’s all about putting console.log wherever really.

The beauty comes in the speed of coding, I can move so fast that I always build a mock version of my api layer and can have the entire UI done rapidly.

ricksharp··on Web based Windows XP desktop recreation, built with React
Wow, you’re right!

That’s faster than I can remember it loading in real windows xp on a desktop (and that was installed versus downloading additional code for that module).

Impressive!

ricksharp··on Web based Windows XP desktop recreation, built with React
No, I was specifically talking about load time which is instant (compared to the majority of the internet which is not).

Also, as far as hardware is concerned, I am comparing a 14 year gap between a desktop computer of 2001 to a 2015 iPhone 6s - a 5 year old phone that still runs on battery for about 6 hours.

But that has nothing to do with load time and why most websites today can’t load in under 1 second (or even 10 seconds).

I’ve heard many complain about React performance, yet I have seen React with ssr or static rendering perform amazingly well.

My site for example loads as fast as hacker news on first page load, and then faster because of static rendering and pre-fetching, yet it has unlimited interaction.

I imagine if I profiled the performance of this demo, it would be similar.

ricksharp··on Web based Windows XP desktop recreation, built with React
Yeah, this is amazing. Works great even on iPhone.

Going to save this one for the next time someone says React is slow.

This worked instantly for me (just like my website, I wonder if they are using Gatsby or something else for static pre-rendering).

ricksharp··on Show HN: TypeScript Hack – Type System Text Adventure
I hope someone pays attention, because this was fun!
ricksharp··on Show HN: TypeScript Hack – Type System Adventure
This is a hack to play a text adventure in the typescript type system (no runtime at all).

Typescript is awesome!

ricksharp··on I am seriously considering going back to desktop computers
I built my desktop about 3 months ago after 16 years of using a laptop.

It’s great!

I also had fun researching how to get the best deal ~$2,000.

ricksharp··on The Story Behind Markdown
Nice!

I’m teaching my children to write their school papers in markdown for similar reasons.

I use a github PR to provide feedback.

ricksharp··on Using const/let instead of var can make JavaScript code run 10× slower in Webkit
No, but it's a great ideal for a blog post! When I have a chance, I'll let you know.
ricksharp··on Using const/let instead of var can make JavaScript code run 10× slower in Webkit
I’ve been doing web since 1990s and I‘ve always thought spreading a UI element across 3 separate files (often in different locations) was an anti-pattern (or 5+ files In 5 different folders if you want MVC).

React is awesome because it allows feature-aligned separation of concerns (each component has a single job - render everything about a specific element - which is usually a well defined part of a specific use case).

Jsx is the best UI system ever in terms of productivity - speaking from experience: I’ve implemented production apps using dozens of UI frameworks/platforms - Html, WYSIWYG, Flash, WindowsForms, WebForms, Ajax, Asp.Net Mvc, Razor, WPF, Xaml, Silverlight, Knockout, Handlebars, PhoneGap, Ionic, Bootstrap, MaterialUI, Angular2, React w/ Class Components, React w/ Mobx, React w/ Hooks

I can tell you pros/cons of each of those. But at the end of the day I can develop an entire app in days in React+Hooks which would take me weeks in most any other.

ricksharp··on Combating abuse without backdoors
I agree, I think crime fighting requires tools that operate at the user level.

So an infiltration bot: We have the technology today (gpt-3 level dialog) that could infiltrate criminal social networks, gather evidence, build credibility and power, and then help shut everything down.

The system itself cannot provide this, but an ai-human actor could.

Of course, this technology is scary: What I think is not a crime - like complaining about the government - is a crime in other places.

ricksharp··on Monospace: A JavaScript demo in 1021 bytes, winner of the demo competition
Awesome work!

That makes sense. I imagine with some experience you have a decent idea about what you can make fit.

ricksharp··on Monospace: A JavaScript demo in 1021 bytes, winner of the demo competition
Thanks for the expansion and comments! On your project, I noticed the comments were about 5 times longer than the source code :) - so that makes sense how to work with it.
ricksharp··on AI that scans a construction site can spot when things are falling behind
I can see the benefits of monitoring progress like this for a good project manager (who isn't micro-controlling or forcing a schedule, but who can keep the stake-holders at bay with good progress reports and early warnings about a schedule adjustment).

On the other side, an easier to implement and more worrisome idea (for me): AI that monitors your git repo to report you when you aren't getting things done quickly...

ricksharp··on Monospace: A JavaScript demo in 1021 bytes, winner of the demo competition
Amazing! Very impressive how you got all the details in. I'd be interested in hearing what the development process is like.

Do you work directly in the minified code, or do you create the demo in normal code first then look for ways to minimize it?

ricksharp··on TypeScript Any Is Evil
Author here - hopefully this post will help you eradicate “any” form all typescript code bases.

I explain a few good strategies to deal with types and hopefully add enough humor to make it entertaining.

ricksharp··on We deleted the production database by accident
Are you sure it was the production database that was affected?

If you are not sure how a hard coded script that was targeting localhost affected a production database, how do you know you were even viewing the production database as the one dropped?

Maybe you were simply connected to the wrong database server?

I’ve done that many times - where I had an initial “oh no“ moment and then realized I was just looking at the wrong thing, and everything was ok.

I’ve also accidentally deployed a client website with the wrong connection string and it was quite confusing.

In an even more extreme case: I had been deploying a serverless stack to the entirely wrong aws account - I thought I was using an aws named profile and I was actually using the default (which changed when I got a new desktop system). I.e. aws cli uses —profile flag, but serverless cli uses —aws-profile flag. (Thankfully this all happened during development.)

I now have deleted default profiles from my aws config.

ricksharp··on Welcome to the Old Internet Again
I agree completely.

I started building websites in 1997 with FrontPage as a teenager. It was horrible - mostly because I was teenager and didn’t have anything interesting to say. It also wasn’t easy and took forever to get anything done. (So just slap an in construction gif in it.)

Now I can build anything I want quickly.

Writing raw html is very inefficient. If you want a friendly to create content, use Markdown.

If you want to structure your content or have some standard components, use React.

Use a static site compiler like Gatsby - that combines it all and makes your site compete with any hand-written html and still contain lazy-loaded interactive elements.

My blog is a perfect example: I can write my blog posts in markdown, paste images in as needed, run a build script, and push the changes. It takes about 1 minute to build and deploy.

But, at the same time, I can hide an entire text adventure terminal simulator in the header bar (that lazy loads on click).

My site loads as fast as any static site, but it transforms into full interactive quickly.

Best of both worlds.

So I can produce well formatted content, cool components, or even multiplayer games - it’s perfect.

We have a paradise of tools - it’s a creator’s dream - (once you figure out the right combination)

https://ricklove.me/cool-stuff

ricksharp··on Room-Temperature Superconductivity Achieved for the First Time
The Game of Life doesn't produce complex behavior from simple rules.

The complex behavior comes from a large enough random starting state combined with a very low minimal required complexity to see something interesting. Also, even for a short interesting run of local behavior, the game never produces a stable behavior that grows in complexity beyond the initial information encoded in the random state. (i.e. if there is a bubble of cool stuff happening somewhere on the 2d plane, something usually interferes with it and destroys that pattern - like waves in the ocean, even when the energy curves combine to form a wave once in a while, they are limited and temporary).

So the Game of Life is actually an example that the system is limited to the information encoded in the initial starting state.

In the starting state there is either:

- a large enough random search space (i.e. a million random attempts with a 100x100 board might get something cool looking)

- intentionality (a person can design a starting state that can produce any possible stable system)

ricksharp··on Room-Temperature Superconductivity Achieved for the First Time
Interesting discussion. I’d like to ask a sincere question:

Wouldn’t a system A that is capable of encoding another complex system B, need to be as complex in order to encode all the information in the result?

It’s like a compression algorithm, you can encode the information, but the complexity level of that information is still there (also the difficulty in compressing the information increases very fast - exponentially or maybe even factorially).

So if the most basic protein sequence requires so many bits of information, wouldn’t anything capable of producing that (in a non-random manner) also require at least that level of information (if not more).

It doesn’t matter what process we call systems A and B.

So it seems if randomness doesn’t solve the problem (because math), then the only conclusion is that there is a fundamental requirement for intentionality.

ricksharp··on A 3D sculpting web application
Amazing. This is really impressive that it worked in my iPhone even.

Since the quality is so high, I’ll add this bug report.

Bug report:

- iPhone

- Zoom in to change brush

- Can’t zoom page afterwords

ricksharp··on Purism – Fund Your App
Give equally among all apps used in a time period sounds like the best metric.

In fact, I would argue that some of the most useful apps might be ones that we use less - because they accomplished the required goal.

ricksharp··on .NET Orleans
I’ve been using C# since 2003, but I’m still 5 times faster in typescript & react.

Besides that the typescript type system is insane. It’s cool to hear about discriminated unions though.

ricksharp··on An Honest Review of Gatsby
This commit has the important pieces. Look for the createPage call and rebuild-trigger.

I’ll try to put together a blog post when I can.

https://github.com/ricklove/rick-love-master/commit/8eebd4f9...

ricksharp··on An Honest Review of Gatsby
I use createPages and I get hot reloading when running gatsby develop.

I also just figured out how to trigger hot reloading for sources that normally don’t trigger it (markdown files which I was manually processing).

Basically, I discovered that gatsby will hot-reload when it sees a change in code files (.tsx). So I created an essentially empty _rebuild-trigger.tsx file and imported that in my main page template.

Now, to change the page content and trigger a hot-reload:

- I have an observable subscribed in createPagesStateful that calls deletePage and createPage - Then write to the file _rebuild-trigger.tsx file

I need to make a blog post because it works great (and I could tie it to any change source - like file system watcher - during development).

ricksharp··on An Honest Review of Gatsby
Yes, I see the scale issues and I don’t have much yet (I assume because I am using createPages it doesn’t use any caching).

At runtime it’s excellent - perfect scores for performance - and using the website is perfect, so I’m thankful that gatsby let me get started quickly and see how good runtime performance can be.

I’m planning to replace it with React’s built in ReactDOMServer (and I can do a simple change detection and rebuild only changed content easily).

Honestly, it will probably be easier then all the hacking I had to do to get gatsby to work the way I wanted.

Page 1 of 6Next →