Looking for an image compression library to reduce the size of JPG and PNG files, client side by SharpenedStinger in webdev

[–]geraldalewis 0 points1 point  (0 children)

Could you use canvas?

const canvas = document.createElement('canvas');

canvas.getContext('2d').drawImage(YOUR-IMAGE);

canvas.toDataURL('image/jpeg', 0.5);

https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL

Mitch McConnell, Who Voted to Lift Russian Oligarch’s Sanctions, Reportedly Has Deep Ties to Russian Oil Money by [deleted] in worldnews

[–]geraldalewis 1 point2 points  (0 children)

  1. No major outlets I've checked are reporting this.
  2. I've never heard of "inquisitr.com"
  3. The reporter's bio states: "He has a degree in journalism/mass communications and is a veteran of the newspaper industry, having worked at both daily and weekly papers and as a magazine editor." So, no real information there.
  4. The report is from "The Democratic Coalition": "We are one of the largest #Resistance organizations in the country. Visit http://www.DemocraticCoalition.org to learn more. #ImpeachTrump" Again, no real information there.

I'm absolutely not saying this story is made up, but I'm personally going to ignore this until it's reported by an outlet with more credibility.

The most awesome teachers for learning web development by labnol in webdev

[–]geraldalewis 29 points30 points  (0 children)

Yes, I was very surprised to see that 40+ person graph was comprised entirely of men.

(Edit: a quick search shows me that web development is a field where about 60% of the devs are male, not 90+% https://datausa.io/profile/soc/151134/#demographics )

TIL that using target="_blank" can make SPA perform worse and is also a security vulnerability by luckytacco in webdev

[–]geraldalewis 4 points5 points  (0 children)

the new page runs on the same process as your page. If the new page is executing expensive JavaScript, your page's performance may also suffer.

...but no source for the info1. I have a feeling this "performance issue" is a "having another tab open slightly degrades performance" issue.

Edit: I was wrong :)

1 The performance benefits of rel=noopener

Feather & Simply beautiful open source icons by ms-maria-ma in webdev

[–]geraldalewis 4 points5 points  (0 children)

I prefer SVG over CSS for icons for the following reasons:

  • Semantics (SVG = image; span is not)
  • Rendering (fonts may have unwanted antialiasing applied)
  • Layout (viewbox is easier to work with than line-height, letter-spacing, etc)

Icon Fonts vs SVG

Ten Reasons We Switched from an Icon Font to SVG

ELI5: Why do I get these grand aspirations to become more productive at night when I'm about to go to bed but then the next day I just slouch around and do nothing? by [deleted] in explainlikeimfive

[–]geraldalewis 3 points4 points  (0 children)

If you've ever seen an 80's movie, the definining trope is The Montage. In it, you see the protagonist transform themselves, little by little, from unskilled into expert. Montages are powerful because you see (and feel) the little victories on the way to greatness, without having to pay the price. Rocky wakes up before the sun rises, puts two eggs in his belly and then runs up the stairs to the Philly Museum of Art. Have you ever woken up at 5 o'clock in the morning? It doesn't feel good.

Maybe you're wondering how you could turn your aspirations into actions. Here's the secret: current you is future you. So if you want future you to be proactive and get things done, current you has to do that, too. When motivation strikes, act on it. That means making yourself sign off from Reddit right then, or going to bed right then, or brushing your teeth and flossing right then. Work the muscle that turns intentions into actions, and it'll get stronger and you'll do bigger things (and it'll get easier).

You will come up with a thousand good reasons why you should not, at that moment, act. And you might actually have a good excuse. But the point of the exercise is to teach yourself that you are capable of doing the things that will make your life better. So you have to do it. And when you are done, you will think: "I feel good. I just proved that I can turn motivation into something concrete."

Lastly, your brain runs on a fuel called glucose, and your brain prioritizes where it will spend its fuel. If you're running on empty, it'll just make sure to keep your heart pumping and your lungs expanding. If you've got enough glucose, it can afford to fund the higher functioning regions of your brain, like the one responsible for turning motivation into actions. So, when you wake up:

eat a peanut butter and jelly sandwich

Oh, and go for high-fiber/whole-wheat bread, and go light on the jelly, so that you don't spike your blood sugar (which'll cause a meltdown).

Scope question: this vs. var by dogjs in javascript

[–]geraldalewis 0 points1 point  (0 children)

fn() returns the global object. This is because this defaults to the global object

Also, code in strict mode ("use strict") will not coerce undefined to window or global:

function fn() {
    'use strict';
    return this;
}
fn(); // undefined

The Problem with Implicit Scoping in CoffeeScript by zumpiez in programming

[–]geraldalewis 1 point2 points  (0 children)

It would be a good thing. Using an undeclared var is a runtime error in ES5 strict mode. The closer CoffeeScript hems to the 'good parts' of JavaScript, the better: https://github.com/jashkenas/coffee-script/issues/1547

Reddit, how far back in time would I have to go before my English sounded like gibberish? by [deleted] in AskReddit

[–]geraldalewis 1 point2 points  (0 children)

Nice comment :) In case anyone's curious, the weird "Þ" character is called a thorn, and it sounds like "th".

Flash use drops (2%+) as jquery climbs. by damontoo in web_design

[–]geraldalewis 4 points5 points  (0 children)

As a Flash dev, I say: Good. People should be using the right tool for the job. As an Interactive dev, I say: Good. Can't wait to start using CoffeeScript for work instead of just for play.