Hi. Sometimes, we create code snippets to help us. In a project, I needed to create an element and its attributes should have been set. I wasn't us...
For further actions, you may consider blocking this person and/or reporting abuse
Specially for testing with
Puppeteer
I have some common functions that I reuse in most of the tests likelogin()
ornavigateToProject()
or util functions to get properties from selectors, etc...This is silly but I have a code snippet of
htaccess
to improve wordpress performance. It's just that my brain has never understood Regex :/I also have code snippets for validations and other little things in vanilla
javascript
.We have a few templates we use, and some reusable code snippets.
Stuff like:
Email Validations
Randomise Date Column
Etc...
I've had a discussion about snippets on here somewhere before. But for me and my programming style, I view code snippets as a horror. I can see that they would be useful for some cases, but those are cases I tend to avoid. What I often do is to create types and functions to encapsulate some code, put it in a library, and then reuse it in different projects.
Any reason you are using string index notation (
data["addTo"]
) and not dot notation (data.addTo
)?For example, I could have a key like that;
In this case, I can't use like that
myObject.userName[]
There are many reasons to use index notation.
medium.com/@prufrock123/js-dot-not...
Yeah, but you don't.
There are many reasons not to, as well.
I use them so often I made my own library (github.com/nektro/basalt)
In particular of note, I have (github.com/nektro/basalt/blob/mast...)
This looks much better and cleaner.
"The ones that do no use frameworks, end up making their own square wheel".
You should not have many snippets between projects, engines, frameworks and shared libs yes.
I do have some common nginx config file suited for my projects, and some general python util functions that i need here and there
clg => console.log()
What kind of codes? But I understand you. Sometimes you don't want to spend more times because of the same problems.