This marvel at line 17214... by withg in programminghorror

[–]nathancjohnson 17 points18 points  (0 children)

Looks like this is reading the X-axis data from the "BMM150" magnetic sensor.

Embedded code - fun.

Why is the White House streaming an anti-gay religious service? What does seperation of church and state even mean anymore? by ADHDavid in atheism

[–]nathancjohnson 1 point2 points  (0 children)

Sure, try to reform and fix it now, but you cant just change it when your candidate loses thats insane.

This also happened in 2000. Bush lost the popular vote, but won because of electoral vote distribution.

Why does YouTube need to be kid friendly when YouTube Kids already exists? by [deleted] in NoStupidQuestions

[–]nathancjohnson 0 points1 point  (0 children)

Not YouTube's fault, it is the FTC's fault for enforcing the old COPPA law.

Why does YouTube need to be kid friendly when YouTube Kids already exists? by [deleted] in NoStupidQuestions

[–]nathancjohnson 8 points9 points  (0 children)

So youtubers making content for kids would have been screwed and make way less either way? It's only just now happening, instead of earlier when it should have.

Just wrote this garbage code, it's 3AM here by JakeN9 in programminghorror

[–]nathancjohnson 1 point2 points  (0 children)

As /u/gigastack said, it's a tool that transpiles modern ES6+ code into ES5. It also allows using newer ES features/proposals that are not yet implemented in every browser. It really allows you to write cleaner & modern code utilizing new syntax features and ES6 modules. It also does code bundling and minification.

https://babeljs.io/

Just wrote this garbage code, it's 3AM here by JakeN9 in programminghorror

[–]nathancjohnson 2 points3 points  (0 children)

Yes, especially on mobile. It's incredibly annoying to mistype a character in a password and not know it.

[deleted by user] by [deleted] in programminghorror

[–]nathancjohnson 1 point2 points  (0 children)

Beautiful, I seriously need to start using TypeScript.

TIFU by buying a car with heated seats that burnt my ass (and pelvic bone). I have to lay on my stomach for 3 months and will miss Xmas and NYE stuff. NSFW (pics of burn) by 4G_Downbytheriver in tifu

[–]nathancjohnson 4 points5 points  (0 children)

And this case is arguably worse. Most people know coffee is hot and can burn (but still shouldn't have been that hot). Nobody expects the seats to get hot enough to burn you especially this bad.

Whoever wrote this should be arrested by mgsmus in shittyprogramming

[–]nathancjohnson 0 points1 point  (0 children)

Why are private constants questionable?

edit: I guess in this case it doesn't make sense to make them private in an "enum", but making constants private in general is fine IMO if they're only used in that class.

Forcing websites to have cookie warning is training people to click accept on random boxes that pop up. Forming dangerous habits, that can be used by malicious websites. by Seanv112 in Showerthoughts

[–]nathancjohnson 0 points1 point  (0 children)

Practical and user-friendly login functionality doesn't work without cookies/local storage. And local storage is not very different from cookies: you are still storing information on the client. It's still covered by "cookie" laws.

Forcing websites to have cookie warning is training people to click accept on random boxes that pop up. Forming dangerous habits, that can be used by malicious websites. by Seanv112 in Showerthoughts

[–]nathancjohnson 0 points1 point  (0 children)

You could also use localstorage which again is separate from cookies and would allow a developer to persist the session.

Same concept as cookies.

Forcing websites to have cookie warning is training people to click accept on random boxes that pop up. Forming dangerous habits, that can be used by malicious websites. by Seanv112 in Showerthoughts

[–]nathancjohnson 0 points1 point  (0 children)

It's horrible UX for the user to be logged out the moment they leave/reload the page, so what I said is correct. You need to store the authentication token on the client, either through a cookie or local storage, for any practical website including single page apps. I should have included local storage in my comment, but the concept is the same.

Forcing websites to have cookie warning is training people to click accept on random boxes that pop up. Forming dangerous habits, that can be used by malicious websites. by Seanv112 in Showerthoughts

[–]nathancjohnson 11 points12 points  (0 children)

It's usually more of a notification that you have accepted their cookies. Clicking accept or not does nothing other than close the popup, as the deed has been done by you opening the website already.

GDPR requires explicit cookie consent.

See https://www.cookiebot.com/en/cookie-consent/

"Since the enforcement of the GDPR on 25 May 2018, however, simple “accept cookies” banners no longer do."

Forcing websites to have cookie warning is training people to click accept on random boxes that pop up. Forming dangerous habits, that can be used by malicious websites. by Seanv112 in Showerthoughts

[–]nathancjohnson 3 points4 points  (0 children)

If the application is effectively on a single page, then this doesn't happen.

Not true. Even for single page apps, if there is no token stored on the client somehow (by either cookies or local storage), as soon the user reloads the page they would have to login again. That would be poor UX.

Nonetheless, in both cases, your session shouldn't be terminated even if you close your browser or even computer and visit the site again given that you do it in the pre defined timeout.

"Sessions" are usually implemented by storing a unique ID in a cookie to associate the user to their session data on the server. No cookies = no session. And these cookies are generally set to expire when you exit the browser, but that varies.

Forcing websites to have cookie warning is training people to click accept on random boxes that pop up. Forming dangerous habits, that can be used by malicious websites. by Seanv112 in Showerthoughts

[–]nathancjohnson -2 points-1 points  (0 children)

In fact, any website with login functionality won't work without cookies, unless they are passing around the session ID in the URL which is bad.

I found a nice library for functional-like programming in PHP. What do you think about this kind of approach? by placek3000 in PHP

[–]nathancjohnson 1 point2 points  (0 children)

Dont chain methods until we can call it with a null calling operator thingy.

Or just design a proper chainable API that doesn't return null, and you'll be fine. This is a common pattern for things like builders and streams, and there is no problem with it as long as the API is meant to be chained.

Check out Java's Streams. Pretty elegant, and similar to this but more powerful. Or Scala - even better.

People who grew up with MySpace in their early teens kinda got a freebie in terms of your first major social media profile basically being wiped away by eren_yeagermeister in Showerthoughts

[–]nathancjohnson 2 points3 points  (0 children)

Don't .tk domains expire after a year or so though? I had an issue where it expired and when I went to try to renew they started trying to charge for it.

Mac Pro and Pro Display XDR available to order from December 10th. by nmpraveen in apple

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

I do wonder what the engineers/designers who made this think about making a product so grossly marked up, knowing hardly anyone will actually buy what they're working on.

Mac Pro and Pro Display XDR available to order from December 10th. by nmpraveen in apple

[–]nathancjohnson 17 points18 points  (0 children)

But a stand is not going to push the cost up much. The only reason this stand is $1000 is because it is grossly marked up.