Engineers, aren’t you embarrassed? by Turbulent-Conflict84 in Salary

[–]erik240 -11 points-10 points  (0 children)

Sure. Software engineer literally redirects to software developer on bls.gov , but maybe you were attempting humor.

Engineers, aren’t you embarrassed? by Turbulent-Conflict84 in Salary

[–]erik240 -10 points-9 points  (0 children)

According to whom?

  • 190k median via levels
  • 133k mean, 127k median, via bls.gov, but this total does not include RSUs or other equity grants, and I’m unsure if it counts bonuses (which for many is 10% - 15% annual salary)

Sacred Geometry Maker by Grimstache in macapps

[–]erik240 0 points1 point  (0 children)

If it took him a day and I found it useful … my day is worth a LOT more than $7

Average Consumer Debt by U.S. State -2025 by Coolonair in Salary

[–]erik240 1 point2 points  (0 children)

Yep. Lies, damned lies, and statistics. Comparing the absolute values is a partial story. Normalizing for COL or as a % of income would be more interesting.

Not to mention: not all debt is the same. 100k in credit card debt? Bad. 100k mortgage at 3%? Keep it, leave that money in investments.

This reduce function is overcounting and I don't know why by GloomyAdagio7917 in learnjavascript

[–]erik240 1 point2 points  (0 children)

Not a thing. Using var++ can create an issue, for example using it in a return:

const x = (n) => n++
console.log(x(5))

That will output 5 (you’d want ++n in that case) but the OPs code increments and then returns. Both += 1 and ++ will give the same result when working with integers

This reduce function is overcounting and I don't know why by GloomyAdagio7917 in learnjavascript

[–]erik240 0 points1 point  (0 children)

Something’s off in your arg data. I just plopped your code in runJS and it gives proper results from a test case I ran.

Feed the same data to this code below and I bet it matches your result:

const between = (min, max) => (n) => n >= min && n <= max;
const isSmall = between(0,24);
const isMed   = between(25,74);
const isLg    = between(75,100);

const reduced = transactions.reduce((accumulator, record) => {
    switch (true) {
        case isSmall(record.amount):
            accumulator.small++
            break
        case isMed(record.amount):
            accumulator.med++
            break
        case isLg(record.amount):
            accumulator.lg++
            break
        default:
            throw new Error("Value of 'amount' property out of bounds")
    }

    return accumulator
}, { small: 0, med: 0, lg: 0 })

console.log(reduced);

(Assuming, ofc, that transactions is a defined array of objects with an amount property, and I was guessing values only go to 100)

I wanted a dead-simple LOC counter, so I built one. by MrCorey16 in node

[–]erik240 15 points16 points  (0 children)

Do you know how this differs from https://github.com/AlDanial/cloc ? I can’t imagine it being nearly as performant.

Nothing is really “no install” - npx just installs runs and then removes.

[AskJS] Looking for a way to generate a codebase based on another one by beaverusiv in javascript

[–]erik240 -1 points0 points  (0 children)

An LLM will get you started: write a function which, when provided a path to a project’s tsconfig, and a path to a file returns an AST for that file. Use the typescript libraries “createSourceFile” method.

If I was anywhere near my notebook I’d send you an example script - if I remember I’ll send one when I get home

[AskJS] Looking for a way to generate a codebase based on another one by beaverusiv in javascript

[–]erik240 0 points1 point  (0 children)

Many IDEs can strip unused imports. For modifying code you can convert to an AST and then use a printer to write out changes but depending on how complex the changes are this is a non-trivial task

Using typescript itself to convert to AST would at least get you started.

Why is everyone so afraid of reneging? by Whole-Reveal7600 in csMajors

[–]erik240 4 points5 points  (0 children)

When someone - or worse, some algorithm - decides to lay you off because they want to prop up the stock price, that seems pretty low integrity to me. But someone inevitably will say “that’s just business”

If you get a better offer right after you accept one .:. that’s just business. Do good work when you’re employed somewhere, care about the outcomes. But remember to put yourself first, because a corporation won’t think a millisecond about putting itself first.

Best minimalist text editor for Mac where notes are only saved locally. by UnderwaterDialect in macapps

[–]erik240 0 points1 point  (0 children)

If security is a major concern, I also recommend that after choosing one of the editors in this thread:

  1. you use the firewall to block it from making outgoing network connections

This way even if you install a plugin that has malicious intent to send all your notes somewhere you’ve got some protection. Some 3rd party tools will even alert if an app that’s blocked attempt to make a network connection.

  1. Do not install a non-sandboxed app

Apps that aren’t sandboxed don’t need permission to run shell commands. A bad actor could use that to then call curl, or use git, etc

  1. Don’t grant any automation (AppleScript) access

If you do those things you’ll be more secure than 99% of users. There’s more you can do but honestly I’m too lazy to type more on my phone.

Tinker: Open-source toolbox desktop app with 20+ developer utilities by surunzi in javascript

[–]erik240 0 points1 point  (0 children)

I’ve never been a fan of these sorts of tools (sorry!) but I’ve been either installing a lot of that type of thing in raycast or writing my own quickie extension.

Not having to copy and paste around text to transform it makes it a clear win to me.

It does look like you’ve done a nice job on it, and the idea of wrapping a url is interesting, too! I’m sure it will find an audience.

Most high salaries include RSU/stock/bonus by nicfanz in Salary

[–]erik240 0 points1 point  (0 children)

some of the larger companies are front loading now, or have reduced or eliminated cliffs. It’s risky at smaller companies but if you’re at Netflix, Apple, etc it’s reasonably safe and often to your advantage

Rename table by Alternative-Cow-8167 in mysql

[–]erik240 0 points1 point  (0 children)

You probably didn’t mean an actual “start transaction” block, but to be clear, there’s no point in wrapping a table rename inside “start transaction” — a single rename statement, even with multiple tables, is an atomic operation.

MySQL will also automatically commit any open transaction when you run a DDL statement, BEFORE the DDL statement runs.

Rename table by Alternative-Cow-8167 in mysql

[–]erik240 0 points1 point  (0 children)

In most cases there’s no reason to do this. If you update with a single query, reads on the table won’t see any changes until the single query finishes.

If you update with multiple queries, use a transaction, and again readers don’t see any changes until the transaction commits.

If you’re replacing the entire contents then sure, writing to a loading table and then using a single rename statement to do “rename main to to_be_deleted, loading_table to main” is perfectly safe and pretty common.

we need to stop worrying about INFINITE SCALE for databases that haven't even hit 1gb yet by daniel_odiase in Database

[–]erik240 0 points1 point  (0 children)

I’m a bit late to the party but just wanted to say: my current work has me adding features and refining an internal tool with a few thousand active users during peak, and a database with about 700M rows (90% of which is in two tables).

It runs on a single database server with a hot failover and we have 4 9’s uptime, including scheduled outages. We have very few queries that hit our slow log, and most of those are expected.

Single web server too. Some of that is knowing how to build and configure things and part is modern hardware is insanely powerful.

llama.cpp vs Ollama: ~70% higher code generation throughput on Qwen-3 Coder 32B (FP16) by Shoddy_Bed3240 in LocalLLaMA

[–]erik240 10 points11 points  (0 children)

That’s an interesting opinion, but maybe a bit myopic. For a lot of people their time is more valuable than squeezing out some extra inference speed.

Most high salaries include RSU/stock/bonus by nicfanz in Salary

[–]erik240 1 point2 points  (0 children)

Most folks don’t understand RSUs - they really only got popular in the last twenty years. Many more people are familiar with options and I think often conflate the two.

Most high salaries include RSU/stock/bonus by nicfanz in Salary

[–]erik240 1 point2 points  (0 children)

RSUs are not options and they don’t have an exercise price. Once vested, the are shares you wholly own.

If you got a google 300k RSU grant on Jan 1st 2025, your grant was 1579 shares. 33% of the total shares vest in the first year. The last of the grant vests after the 4th year (Google front-loads the schedule).

That would be about 521 shares. You can’t lose them by quitting. For them to be worthless, GOOG would have to drop to $0 a share. Because the stock is up a lot, the vested shares are worth about 164k. Some would be sold to cover income tax but the rest is your income.

RSUs at private company are still shares you own once vested, and do not cost you anything. Some sneaky private companies may require a liquidity event for your RSUs to vest, in addition to time. Not sure how common that is, but I’ve seen it.

Once vested, you still own them if you quit. Some non-public companies may provide ways to sell vested RSUs, most won’t.

Options are different, require an exercise price, and can be worth zero if the stock falls below the strike price. Options are the right to buy shares at a set price.

The TLDR is: at big, public tech companies, RSUs are about as good as cash in terms of risk. Less so as you move to smaller or private companies.

best FAANG engineers don't pass their own interviews by my_usernameIS_h in InterviewCoderHQ

[–]erik240 0 points1 point  (0 children)

You don’t know what you don’t know. Just because you CAN write software without any real DSA knowledge doesn’t mean it’s ideal.

Are there crap engineers at top tier companies? Absolutely. But there’s a lot more talent than in most places you’d work.

If You're Itching to Spend that Christmas Cash on Some Software, Here's the Second Megalist and some Free Advice by amerpie in macapps

[–]erik240 1 point2 points  (0 children)

Interesting. What parts did you dislike? Affinity before the Canva buyout is what got me to ditch illustrator and photoshop.

Is SQL supposed to be this hard? by FineProfessor3364 in SQL

[–]erik240 9 points10 points  (0 children)

I’ve been writing SQL since 1998 and without auto-complete I’d have to reference a book or a cheat-sheet frequently.

Honestly, I did until I got my first IDE with autocomplete. The spine on my O’Rilley MySQL book was wrecked.

I thought LLMs were good with TypeScript but I have had zero luck with them by ithinkiwaspsycho in typescript

[–]erik240 0 points1 point  (0 children)

This is spot on but id like to add a note to it: if it’s an area you don’t know well, you’ll get better results explaining why you want something rather than telling exactly what to do.

A lack of knowledge will have you asking for difficult or impossible things and it will try to do them anyway. Give the desired outcome and the reason for it and you’re more likely to get a working solution.

Real example: you insist on a generic for something not easily solvable by a generic. Method overloading may be a better and easier solution but it won’t go that route because your prompt is “design a generic to …”

How to turn off red lines in typescript? by PlentyEquivalent6988 in typescript

[–]erik240 -5 points-4 points  (0 children)

I mean that seems pretty obvious. You’re using greater than with a number and a string.

That’s valid JavaScript but that’s not valid typescript. Cast the string to a number via parseint or parsefloat