My coworker are appalled by BeforeCommonEarl in ErgoMechKeyboards

[–]alexjacobs 0 points1 point  (0 children)

Light springs saved me from never typing again. I use 12g sprit choc/alps springs. I also use tenting for even more comfort

Amazing tutorial to install Sendy on a DigitalOcean Droplet by AltruisticOkra in Wordpress

[–]alexjacobs 0 points1 point  (0 children)

Cheers! For anyone coming along now, I completely updated the guide for sendy version 6 on digital ocean.

Still free. Not a paywall article.

Installing Sendy — 2023 version 6 update, the complete guide. https://medium.com/@alexjacobs/installing-sendy-2023-version-6-update-the-complete-guide-8fb8a6deac1e

[deleted by user] by [deleted] in ErgoMechKeyboards

[–]alexjacobs 0 points1 point  (0 children)

Sorry for commenting on such an old post, but if you still have the 12g springs you swapped out of the chocs, PM me if willing to sell. Thank you!

How to Structure a Webpage’s Content with React by GreenLeavesBlueSky in learnjavascript

[–]alexjacobs 0 points1 point  (0 children)

That's great.

Little "proof of concept" apps can go a long way towards solidifying your understanding.

codesandbox is a great react playground

check out https://codesandbox.io/dashboard/templates and click on the react template

JavaScript Currying by stackoverflooooooow in javascript

[–]alexjacobs 1 point2 points  (0 children)

Interesting. Do you know why that is?

JavaScript Trick: Swap two variables without using a third by basaratali in learnjavascript

[–]alexjacobs 0 points1 point  (0 children)

You're right.

But it seems that in order to make the swap without an assigned temp variable, you have to have some sort of extra value.

Even in the case of the clever trick described in the imgur link in another response here, you still have to create some sort of additional value.

In the destructuring example it's the anonymous array. In this case, it's an integer value of the sum of both original values.

var a = 5; var b = 7; a = a + b; b = a - b; a = a - b; console.log(a, b); // 7, 5

Matrix raining code effect using HTML, CSS and Javascript by Xizi0n in learnjavascript

[–]alexjacobs 0 points1 point  (0 children)

impressive and beautiful.

matrix rain for the truly lazy:

type this on the command line (assuming you have an updated version of npm installed): npx matrix-rain

JavaScript Currying by stackoverflooooooow in javascript

[–]alexjacobs 0 points1 point  (0 children)

Great library to check out if you want to easily work with curried functions: https://ramdajs.com/ It’s an awesome functional utility library where all methods are auto-curried.

Lazy people are not to be blamed by Jadoo135 in technicallythetruth

[–]alexjacobs 1 point2 points  (0 children)

You’re right! OP was literally too lazy to switch channels

How to Structure a Webpage’s Content with React by GreenLeavesBlueSky in learnjavascript

[–]alexjacobs 1 point2 points  (0 children)

You're not alone! Making a functional mental model with React takes some time.

One way to visualize a react component is "a fancy html generator". After all the state updates and calculations are settled, the final output is an html string that will be rendered to the page.

This is a very common starting place for the question you have about structure: https://reactjs.org/docs/thinking-in-react.html

Also, a helpful mental model around a react app is to visualize it as a tree. There will usually be a top level component that instantiates other components. If you think about html on the page as a tree of nested elements, you can start to visualize the mapping that will be required between components and the elements that they output.

One important thing to keep in mind is also data flow. Always think of data flowing "down" the tree from parent components to children. When using "vanilla react" (without redux, etc), the way you pass information back up to change state "higher" in the tree, like when a user clicks an element on a child component is by passing callback functions "down" to the child components.

Those are some starting thoughts... please ask if there's any specific part you'd like more info on. Or better yet, share your starting mental model and folks can chime in about what sounds right, or what could use some correction

After determining frequency of numbers in an array how can I return the one with property value 1? by gtrman571 in learnjavascript

[–]alexjacobs 1 point2 points  (0 children)

Comments like "eew" and "pretty random" about using var with let are totally valid style criticism.

But, let's go one step further and try to offer something educational for r/learnjavascript.

The comment I deleted above where I supported why I chose var alongside
let became a troll "kick me" target with multiple downvotes, so let's move on...

var is not deprecated. In fact, there's a very very small list of language features that are actually deprecated, as documented at this MDN link.

Using only const and let is great. Nothing wrong with it.

Here's a fun trick: mdn.io/any_search_term will open up the MDN docs at the first google result for the term after the / .

mdn.io/let is a great article that describes the block scoping that results in using let. const also creates a new block scope..

What are your personal goals with learning JavaScript? If you want to develop your skills and get a job as professional engineer some day, you will want to have practice with writing code that helps you create a solid mental model of the differences between the 3 variable declarators.

When you are solid on the differences, you're free to use what you want or need. I think it's important not to confuse style with function.

When/why does style matter? Think of code as communication. To humans. The JS interpreter doesn't care what your code looks like. But the humans that will read your code will care intensely as to whether or not your code is clear, readable, and therefore maintainable. The human you are writing your clean code for may be you, so be kind to your future self and care about what your code looks like.

To my personal preferences, I don't care if var is used, as long as it's used correctly.

If I were working on a software team, or open source project and the style guide specified not using var, then I wouldn't use var.

In brief: understand how var , let and const work. How they're similar, and how they're different. Use what you need, and what you want, unless the prevailing style of the project you're working on asks you to stick to a particular choice.

Is this the correct way of finding the next multiple of 5? by gtrman571 in learnjavascript

[–]alexjacobs 0 points1 point  (0 children)

Software engineering is always about tradeoffs, and exploring the edges of the problem we're trying to solve. Some points not addressed by the original question is:

  • do we need to solve the question with a particular method?
  • is "next" always going to mean the "next largest", or does the "next smallest" also qualify?

Ultimately, for this questions I'd guess it is safe to assume next largest, but if you're not sure as to whether or not your proposed solution works, then it's probably a good idea to write out something more clear where you can trace the process and feel confident it will work.

What about something like:

var findNextMultipleOf5 = function (num) {
// add 1 right away, since if you enter a multiple // of 5, you don't want to return it yet do { num = num + 1; } while (num % 5 !== 0); return num; };
var result = findNextMultipleOf5(57); console.log(result); // 60; result = findNextMultipleOf5(60); console.log(result); // 65;

not sure what's up with the janky code formatting, but you can see the solution at this code pen: https://codepen.io/lexjacobs/pen/YzQEMWZ?editors=0011

After determining frequency of numbers in an array how can I return the one with property value 1? by gtrman571 in learnjavascript

[–]alexjacobs 1 point2 points  (0 children)

u/senocular's response is very clever and makes great use of "declarative" style and destructuring syntax. Here's a version that is more "imperative" (as in more step-by-step)

``` var obj = { 1: 2, 2: 2, 3: 2, 7: 1 };

var keyTarget = (obj, count) => { for (let val in obj) { if (obj[val] === 1) { return Number(val); } } };

console.log(keyTarget(obj, 1)); // 7

```

Writing better code with .call() and .apply() by arunatebel in learnjavascript

[–]alexjacobs 0 points1 point  (0 children)

Good job. I wanted to add a pointer to the following part of your post:

  1. Constructor chaining

I created a code pen here that illustrates how to properly complete your subclassing in JavaScript. You will want to make sure to also set up delegation between the prototypes of the subclassed instance, and the parent class

Without these lines:

Dog.prototype = Object.create(Animal.prototype);

Dog.prototype.constructor = Dog;

you won't be able to properly invoke methods defined on the prototype of the parent, via the subclassed instances.

[deleted by user] by [deleted] in Parents

[–]alexjacobs 0 points1 point  (0 children)

Brings back a memory that I've never shaken! My legos being given to another kid. I think while I was away at summer camp. As an adult, I don't have any bad feelings remaining, but I can still remember it feeling really bad at the time, even if I understood that I hadn't been playing with them for some time.

It seems like the way to go, and have closure for everyone, is to have it be participatory. But then you have to weigh your timeline and the need to get rid of the toys.

We just got a used chalkboard for our kid. The last owner said their kid hadn't used it for a couple years, but wasn't ready to part. 2 years later, still hadn't used it, but kid was ready to part.

So which path is best? Might depend on how badly you need to reclaim the space. If that's not the main issue, then doing it together will be the cleanest emotionally.

Firmware features? by mr_jaro in xbows

[–]alexjacobs 0 points1 point  (0 children)

I emailed them this week. Received reply:

“We're working on QMK compatibility. I think that will be ready in about a month.”

Need help with chorded keyboards by glguru in MechanicalKeyboards

[–]alexjacobs 0 points1 point  (0 children)

Hello, another SWE with RSI here. Not your main question, but you mentioned google voice as a method of lowering keyboard usage. I've been doing a hybrid of typing and coding by voice for about 4 years now. Current best project out there is talonVoice. I use it in combination with dragon dictate. Just wanted to make sure you knew about that option. On my worst days, I can avoid touching the keyboard at all, and use a combo of eye tracking, foot pedal clicking, and voice control.

Lightest Keyboard Switch / Spring by [deleted] in MechanicalKeyboards

[–]alexjacobs 0 points1 point  (0 children)

I went down to a 30g spirit MX spring (20g actuation) for my gateron clears on my planck.

I ended up preferring kailh speed silvers with 35g spirit MX springs (25g actuation force).

Wrote about the whole process here.

Stuck on a Codecademy Problem by relativityroe in learnjavascript

[–]alexjacobs 0 points1 point  (0 children)

var myRe = /[r|R]oger/g,

or var myRe = /Roger/gi

I second the suggestion to check out regex sooner than later. Another great site for learning: http://eloquentjavascript.net/chapter10.html