• 2 Posts
  • 83 Comments
Joined 1 year ago
cake
Cake day: June 19th, 2023

help-circle
  • This doesn’t seem overly useful.

    It’s a list taken out of a bunch of books with no regard for how something can be the best path in one language and a smell in another language.

    Look at this page for example: https://luzkan.github.io/smells/imperative-loops

    It suggests using functional loop methods (.map(), .reduce(), .filter()) instead of using imperative loops (for, for in, for each) but completely disregards the facts that imperative loops also have access to the break, continue, and return keywords to improve performance.

    For example: If I have an unsorted list of 1000 cars which includes a whole bunch of information per car (e.g. color, year manufactured, etc…), and I want to know if there were any cars were manufactured before the year 1980, I can run an imperative loop through the list and early return true if I find one, and only returning false if I haven’t found one by the end of the list.

    If the third car was made in 1977, then I have only iterated through 3 cars to find my answer.

    But if I were to try this with only functional loops, I would have to iterate through all 1000 cars before I had my answer.

    A website with blind rules like this is going to lead to worse code.







  • I’m under the impression that there’s two reasons we don’t have it in chromium yet:

    1. Google initially ignored jpeg-xl but then everyone jumped on it and now they feel they have to create a post-hoc justification for not supporting it earlier which is tricky and now they have a sunk cost situation to keep ignoring it
    2. Google today was burnt by the webp vulnerability which happened because there was only one decoder library and now they’re waiting for more jpeg-xl libraries which have optimizations (which rules out reference implementations), good support (which rules out libraries by single authors), have proven battle-hardening (which will only happen over time) and are written safely to avoid another webp style vulnerability.

    Google already wrote the wuffs language which is specifically designed to handle formats in a fast and safe way but it looks like it only has one dedicated maintainer which means it’s still stuck on a bus factor of 1.

    Honestly, Google or Microsoft should just make a team to work on a jpg-xl library in wuffs while adobe should make a team to work on a jpg-xl library in rust/zig.

    That way everyone will be happy, we will have two solid implementations, and they’ll both be made focussing on their own features/extensions first so we’ll all have a choice among libraries for different needs (e.g. browser lib focusing on fast decode, creative suite lib for optimised encode).







  • What specifically do you think is legacy in that comparison? The coloring? The horizontal layout? The whitespace?

    Note: I’ve changed the first link from https://github.com/cxli233/FriendsDontLetFriends/network to https://github.com/zed-industries/zed/network. Still the same view, but just a different repo to highlight the problems

    1. It’s in a small non-responsive box
    2. Ridiculous spacing
    • If you want to see the commit messages, you either need to hover over a dot which increases visual scanning durations or you need to go to the commits view which only shows the commits on a single branch
    1. It doesn’t show commit messages
    2. It’s scrolling horizontally
    3. Branches cannot be collapsed
    4. Branches cannot be hidden/ignored
    5. No way to search for commits
    6. No way to select multiple commits
    • Which also means no way to diff any specific commits together
    • And there’s also no way to perform an action over a range of commits
    • And there’s also no way to start a merge/merge-request/pull-request/etc… between two commits
    1. No way to sort by date/topologically
    2. Keyboard controls only moves view instead of selecting commits

    I’ll stop here at 10 reasons (or more if you count the dot points), otherwise I’ll be here all day.


    The network view lays out forks and their branches, not only [local]/[local+1-remote] branches.

    Yes, but the others can do that while still being usable.

    I don’t know what IDE that miro screenshot is from. […]

    It’s gitkraken

    […] But I see it as wasteful and confusing. The author initials are useless and wasteful, picking away focus. The branch labels are far off from the branch heads. […]

    The picture doesn’t do it justice, it’s not a picture, it’s an interactive view.

    You can resize things, show/hide columns, filter values in columns to only show commits with certain info (e.g. Ignore all dependabot commits), etc… Here’s an example video.

    […]The coloring seems confusing.

    You can customise all that if you want.





  • There are some tools/libraries that act as a front-layer over regex.

    They basically follow the same logic as ORMs for databases:

    1. Get rid of the bottom layer to make some hidden footguns harder to trigger
    2. Make the used layer closer to the way the surrounding language is used.

    But there’s no common standard, and it’s always language specific.

    Personally I think using linters is the best option since it will highlight the footguns and recommend simpler regexes. (e.g. Swapping [0-9] for \d)


  • At least once every few days while coding, usually to do one of the following:

    1. Select multiple things in the same file at the same time without needing to click all over the place

      Normally I use multicursor keyboard shortcuts to select what I want and for the trickier scenarios there are also commands to go through selections one at a time so you can skip certain matches to end up with only what you want.

      But sometimes there are too many false matches that you don’t want to select by hand and that’s where regex comes in handy.

      For instance, finding:

      • parent but not apparent, transparent, parentheses, apparently, transparently
      • test but not latest, fastest, testing, greatest, shortest
      • trie but not entries, retries, countries, retrieve
      • http but not https

      … which can be easily done by searching for a word that doesn’t include a letter immediately before or immediately after: e.g. \Wtest\W.

    2. Search for things across all files that come back with too many results that aren’t relevant

      Basically using the same things above.

    3. Finding something I already know makes a pattern. Like finding all years: \d{4}, finding all versions: \d+\.\d+\.\d+, finding random things that a linter may have missed such as two empty lines touching each other: \n\s*\n\s*\n, etc…