teleren/devto huggingface dataset:
Respect the module: code consistency
Tags: softwareengineering, thoughts
Published: 2021-09-18 11:14:45

---
title: Respect the module: code consistency
published: true
date: 2021-09-18 11:13:00 UTC
tags: Softwareengineering,Thoughts
canonical_url: https://www.rockandnull.com/module-code-consistency/
---

 ![Respect the module: code consistency](https://images.unsplash.com/photo-1605185902099-3cf1261eae92?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDJ8fHJlc3BlY3R8ZW58MHx8fHwxNjMxOTYzMjMz&ixlib=rb-1.2.1&q=80&w=2000)

I've talked before about the [codebase consistency](https://dev.to/mavris/on-code-style-and-consistency-433b-temp-slug-5065226) using a common code style for the entire team.

But programming is an expressive endeavor. Even the most strict code style cannot make the entire code base uniform when multiple people are working on it.

This is especially noticeable in a "module" within the codebase where one or a small number of people have been almost exclusively contributing for some time. The module might be completely compliant with the agreed code style but still, have its own unique "style".

For instance, within the module, you might notice that calculations are executed on variable getters the first time they are used. But you have usually performed these calculations in the constructor to be ready when needed. Performance-wise this is quite similar (assuming the calculation results will be used anyway soon after initialization). The code style does not mention anything about this case (and rightly so).

So when you are asked to contribute to that module and notice this implicit style, what do you do? Most of the time you might think that your way of doing things is better / more performant / more readable.

But usually it's just different styles. And as a good citizen of the codebase, you should respect the style of the module.

Over the lifetime of a module (hopefully many years before a rewrite is needed) probably a handful of engineers will contribute. Just imagine what a mess would become if every engineer just ignored the module's style and made a change using their own coding style. The module would soon become quite difficult to parse. Even if it fully adhered to the [team code style](https://dev.to/mavris/on-code-style-and-consistency-433b-temp-slug-5065226).

The alternative, if you strongly believe that the module's style is terrible, is to completely "migrate" the module to be self-consistent to a new (your) code style. This would require way more time commitment but at least would leave the module in a consistent state. So think carefully if the code style is indeed terrible or just different from your own.

Hopefully, I gave some food for thought when contributing to modules you don't own within the codebase.

Happy coding!
Ways to build a passive income as a developer
Tags: webdev
Published: 2021-09-18 10:51:24

 __PAID CONTENT WRITING:__

There are a lot of website which is pay you as a developer if you write content for them .you can get up to USA $300/article. The publications are usually the company they create their content marketing strategy Ex: LogRocket, DigitalOcean. So looks for the company and see if you can write some article for a theme which pretty much similar to your domain. I think it is an easy way to make money.

 __SELLING INTERACTIVE COURSES ONLINE:__

As per selling interactive courses online instant of video base courses, to create any interactive courses using any programming languages or any framework like Next.js, React, Angular, Go, Spring boot. Here people can come and write the code and learn an effective way. Just pick up your framework and create an interactive and hand’s practice base course and shell it into the people. This is provable the best way to generate passive income in long term .there are number of platforms where you can create interactive courses.
Like: [codedamn](https://codedamn.com/)

 __BRAND BUILDING:__

If you have a lot of audiences on Youtube or on Twitter or some other social platforms you would drive a lot of ads revenue or from sponsorship.

 __MENTORING OTHER DEVELOPER:__

You can charge an hour basic to mentioning other developers when they are getting stuck. if you have good knowledge on the developing line.it is an active income because you invest your time but it will enhance your knowledge.

__START FREELANCING:__

We all know that we can start your career as a freelancer. if you can create a good brand on then you can charge a good amount according to the project.

Those are 5 way to earn a good amount of money by investing your knowledge. 

But keep in your mind to build your passive income needs your consistent effort and time.
Arrays: Deletion with searching in C++
Tags: cpp, arrays, datastructure, programming
Published: 2021-09-18 10:42:35

I was practising arrays in C++, for competitive programming. While coding for basic operations, I thought to code for deleting elements while searching for them. 

Jumped to google and after searching for like 30 minutes, I got no stuff related except one article from GFG, which showed me a complex code. But the code from GeeksforGeeks didn't run when array contained same value elements. Without wasting time on searching, I started writing algorithm for the solution I want. 
And after an hour, I was able to write an algorithm which works for array with same elements, and array with different elements.

I don't know whether solution is available on internet or not, it must be there, but hard to find. See if my solution helps in this, although the time complexity of this solution is not as efficient as it should be.

The program doesn't include any STL functions, since I am a beginner in DSA with C++ twice.

Link to GFG solution : https://www.geeksforgeeks.org/delete-an-element-from-array-using-two-traversals-and-one-traversal/


Code:
```

int deleteSearch(int a[],int n, int val){

// val is value to be searched
// n is the size of static array

     int i = 0;  
     while( i < n){

         if(a[i] == val) {

             //shifting and deleting elements
             while(i < n){
                 a[i] = a[i+1];
                 i++;

             }

             n--;
             i = 0;

         }

         else 
             i++;
        
     }
     return n;
 }

```



The program works for all cases.  Please share you views,corrections and solutions.
Converting Angular sub-Modules into Custom Angular Elements
Tags: angular, webcomponents, angularelements
Published: 2021-09-18 10:39:01

I have an application with nested modules and each module has multiple components inside it. Can I convert one of my submodule (with many angular component) into angular element so that it can be used by other external application as web component.

My consumer application is in plain Javascript. Can someone guide here.
How To Host your static website with Github
Tags: github, html, css, javascript
Published: 2021-09-18 10:34:45

You Have an Html, Css and Js files in your computer and you want to show it to your colleagues ?
Github Has an amazing static site hosting service that takes HTML, CSS, and JavaScript files straight from your repository

Lets go to the steps:

### 1- Create a repository with your username followed by `.github.io`

in my case my username is `BegDevv`, so the repo name would be `BegDevv.github.io` :
![Create a Repo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o1v06qy17jxfw4f5usyz.png)

### 2- Upload your static files into that repository (Html/Css/Js)

you're done 💯 ❤ github will host your files in that repo automatically Go to `https://{yourusername}.github.io` (change yourusername with yours)
Autodeploy subdirectory to Firebase
Tags: firebase, github, devops, autodeploy
Published: 2021-09-18 10:34:16

Google Firebase has a pretty straightforward guide to setting up auto-deploy from Github, which you can take a look at here: https://firebase.google.com/docs/hosting/github-integration

In a nutshell, you follow these steps:

- Install firebase-tools via npm: ```npm install -g firebase-tools```
- Setup your project for firebase hosting: ```firebase init hosting```
- Setup your project with Github Actions to auto-deploy on PR/Merge: ```firebase init hosting:github```


One thing to note is the root directory of your repository is the working directory for the Github actions. For example, if you have a repository that has a subdirectory named "front", which contains your actual project files, package.json, etc.., you have to modify the generated .yml file that firebase-tools generates so that the actions run within the working directory. After you run an npm command, you use 'working-directory' <directory_that_your_package.json_is_in>

You also need to set the working directory for the 'FirebaseExtended/action-hosting-deploy@v0' action, which is set like so: `entryPoint: <directory_that_your_firebase.json_is_in>`

Here is an example:
```
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
'on':
  push:
    branches:
      - main
jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: '14.17.3'
      - run: npm ci 
        working-directory: ./front
      - run: npm run build
        working-directory: ./front
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: '${{ secrets.GITHUB_TOKEN }}'
          firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PROJECT }}'
          channelId: live
          projectId: project
          entryPoint: ./front
```
How to override create-react-app jest config w/t restrictions
Tags: react, testing, javascript, tutorial
Published: 2021-09-18 10:28:06

The below snippet allows you to override react testing library to pass custom global variables to your jest tests. Sure, it is a hack but this way you can override any jest args without ejecting from create-react-app. Just run it instead of the standard test script 😉.

```javascript
const fs = require('fs')
const vm = require('vm')
const jest = require('jest')

const extractJestArgsFromReactTestScript = () => {
  const sandbox = vm.createContext({
    capturedArgs: null,
    console,
    process,
    require: path => (
      require(path[0] === '.' ? `${__dirname}/../node_modules/react-scripts/scripts/${path}` : path)
    ),
    __dirname: `${__dirname}/../node_modules/react-scripts/scripts`
  });

  const testScriptContent = fs.readFileSync(`${__dirname}/../node_modules/react-scripts/scripts/test.js`, 'utf8')

  const scriptAsArray = testScriptContent
    .trim()
    .split('\n')

  scriptAsArray.pop()
  scriptAsArray.push('capturedArgs = argv')

  const scriptToRun = scriptAsArray.join('\n')

  vm.runInContext(scriptToRun, sandbox)

  return sandbox.capturedArgs
};

const capturedArgs = extractJestArgsFromReactTestScript()
const jestConfigValueArgIndex = capturedArgs.findIndex(arg => arg === '--config') + 1
const jestOverriddenConfig = JSON.parse(capturedArgs[jestConfigValueArgIndex])
const overriddenArgs = [...capturedArgs]

jestOverriddenConfig.globals = Object.assign(jestOverriddenConfig.globals || {}, {
  someGlobal: 'hello!'
})

overriddenArgs[jestConfigValueArgIndex] = JSON.stringify(jestOverriddenConfig)

jest.run(overriddenArgs)

```
Elucks (ELUX) सिक्का मूल्य भविष्यवाणी।
Tags: eluckstoken
Published: 2021-09-18 10:16:59

अपने पसंदीदा क्रिप्टोकुरेंसी की कीमत भविष्यवाणी की खोज करें। हम विभिन्न क्रिप्टो विशेषज्ञों द्वारा की गई मूल्य भविष्यवाणियों की एक श्रृंखला शामिल करते हैं। इसके अलावा, विभिन्न क्रिप्टोकरेंसी जैसे Elucks Coin, verge, और अन्य सभी सिक्कों की कीमत की भविष्यवाणी का विवरण प्राप्त करें।

ELUCKS (ELUX) 2021 के लिए मूल्य भविष्यवाणियां

2021 में ELUCKS (ELUX) के लिए क्रिप्टो विशेषज्ञ क्या भविष्यवाणी कर रहे हैं? आइए 2021 के शेष महीनों में देखें कि क्रिप्टो विशेषज्ञों का मानना ​​​​है कि ELUCKS (ELUX) के लिए क्या हो सकता है।

2021 के बुल मार्केट में ELUCKS (ELUX) की वृद्धि इतनी चरम पर है कि पिछली भविष्यवाणियां जल्दी पुरानी हो गई हैं। इसका एक उदाहरण डिजिटल सिक्का है। मार्च 2021 की शुरुआत में, निवेश विश्लेषण प्लेटफॉर्म ने भविष्यवाणी की थी कि ELUCKS (ELUX) 2021 के अंत से पहले $0.01 की अधिकतम कीमत तक पहुंच जाएगा, लेकिन Elucks कॉइन की मौजूदा कीमत पहले से ही $0.02 है, तो Elucks Coin अब क्या होने की उम्मीद करता है? हम यह देखने के लिए देख रहे हैं कि Elucks की कीमत के लिए वे क्या मानते हैं।

Elucks Coin 2021 के अंत तक 2$ डॉलर तक पहुंच सकता है।

2021 में Eluck की कीमत में नाटकीय रूप से बदलाव आया है। हालांकि यह कम कीमत वाली क्रिप्टो निश्चित रूप से बिटकॉइन की बुलंद ऊंचाई तक कभी नहीं पहुंची है, लेकिन बाजार में बुल मार्केट की शुरुआत के बाद से इसने कई मील के पत्थर हासिल किए हैं। पहली बार $0.05, $0.1, और यहां तक ​​कि $0.15 को पार करने के बाद, इसने निवेशकों का नया ध्यान आकर्षित किया और $6.11B की वर्तमान बाजार पूंजीकरण दर हासिल की। लेकिन Elucks की कीमत के लिए आगे क्या है?
Croatia, Austria, Ukraine ✈ Vlog | Speaking at Infobip Shift & PyCon | 2021
Tags: vlog, publicspeaking, conference, introvert
Published: 2021-09-18 09:55:02

## 8 days, 5 countries, 2 conferences
### Dealing with anxiety and networking.

Hello beautiful people, in this video I’ll show you my last 8 days traveling in Europe and attending as a speaker 2 tech conferences. 

Notes:

1. I used to travel a lot in conferences all over the world, but then covid happened and I stopped! Maybe the old followers/readers, already know that, but as I usually say, I have 2 passions: my job and traveling. So when these 2 things can be combined you can bet I am a happy girl 😊

2. Also, I am fully vaccinated and I take seriously all the health regulations. It's not only about my well-being but also about the people around me. I would never jeopardize their health.

## Let the journey begin...

## ⏲ Timeline
00:00 Day 0: Greece, Preparation
01:41 Day 1: Greece to Germany to Croatia
04:50 Day 2: Croatia - Infobip Shift 
10:08 Day 3: Croatia - Infobip Shift 
12:38 Day 4: Croatia to Austria
18:25 Day 5: Austria to Ukraine
21:49 Day 6: Ukraine - PyCon Odessa
23:48 Day 7: Ukraine - PyCon Odessa
24:13 Day 8: Ukraine to Germany to Greece 
25:10 Day 9: Greece, Thank you!

👧 Conferences:
◼ Croatia, Infobip Shift - https://shift.infobip.com
◼ Ukraine, PyCon Odessa - https://pyconodessa.com

📝 You can read in details about my trip [here](https://dev.to/eleftheriabatsou/how-a-shy-introvert-dev-with-anxiety-issues-spoke-at-2-conferences-5e67)

**************************************

👋Hello, I'm Eleftheria, Community Manager at Hashnode, developer, public speaker, and chocolate lover.

🥰If you liked this post please share.

🍩Would you care about buying me a coffee? You can do it [here](https://www.paypal.com/paypalme/eleftheriabatsou) but If you can't that's ok too!

**************************************

🙏It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.

🌈[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/elef_in_tech) | [LinkedIn](https://www.
Learn as a beginner coder!!
Tags: webdevlopment
Published: 2021-09-18 09:50:41

As a fresher, whatever I have experienced, I am going to share some points which might be helpful to save time as a developer.

1. Stick with one programming languages In the initial stage students or Beginners are switching between multiple languages is not a good idea, you have to master one language first.

2. Learning with doing while watching tutorials or read any concept from the document, the Best way to apply practically with writing code is, Make your hands dirty as much as you can, then only your actual learning is! eg, creating a small app.

3. Never jump directly into competitive programming Before clear basic concept never jump, otherwise you feel discouraged and you give up.

4 Learn to not give up. Never give up very easily, Try twice, thrice good things take time.

5. Don't try to memorize the solution It does not matter How much you code, if you memorize then you are down and never succeeded in programming.

6. Ask Question Never hesitate to ask doubt, question event it is silly but Make sure you have to try more than two three time itself, and also learn to frame question what exactly you want to know If you ask a question in a specific way its save lots of time.

7 Pair programming it helps a lot in many ways while sharing your code with a pair partner you have to know about different logic which may better than you, it helps while debugging, sometimes you feel demotivated like not doing code , just connect with your pair partner and start.

9. Join Community join the developer community on discord,redit,or any other social platform there are lots of good and helpful developers where you can easily ask questions, doubt

10. Proof of work share your proof of work on GitHub or any social platform and also with friends, this skill is really very helpful, it gives you confidence and you recognize where I am lacking with help of feedback, and this skill makes you get a job easily.

11. Online meetup and tech blog Attend tech webinar, Read tech news like hashnode.com, dev.to, medium, etc, articles so that you are updated about which Tech stack is going on the market, and it is also really helpful day to day life.

12. Live coding Start doing live coding with some groups of programmer, its boost your confidence and clear your concept in an exponentially way.

13. Breaking down into a smaller chunk of problems!! This skill helps if you have a complex program or even it is small then you have applied , this is so powerful skill.
Andela bootcamp experience
Tags: javascript, devops
Published: 2021-09-18 09:15:37

Boot camp at Andela has been a great life experience in my life, My expectations were greatly different from the real experience I have got here at Andela. Andela has been the most important and excellent community that every person with a desire of becoming a good and professional software engineer can wish to be.

I did not have enough experience in project management and software development but these few days I spent in boot camp I have learned a lot from it especially I have added some values to what I had like Integrity, working together as a team, ask for help if you are not understanding the flow of the given task.

Through the boot camp, I have encountered other specific values, I have learned to be punctual, being an organized person, making plans of what to do, and setting the exact time of accomplishing the given tasks through the pivotal tracker project management tool and also the "Stand up Alice". I have also got many skills in programming and website development, projects management I didn't know how to use some languages like JS(ES6) but through the assistance of my fellow boot camper, I have learned a lot from them.

To sum up, My journey to his boot camp at Andela has been an experiencing and awesome journey, and I wish to join the Andela community because I want It to be my lifetime career.

"If you want to go quickly, go alone. If you want to go far, go together."
Credit card input
Tags: codepen
Published: 2021-09-18 09:01:01

I just created a simple **credit card input** field. Please see it on Codepen:

https://codepen.io/amiryxe/pen/QWgQPEa

or [github](https://github.com/amiryxe/credit-card-input)

{% codepen https://codepen.io/amiryxe/pen/QWgQPEa %}
ReactJS Suppressing the footer element when user navigates to a page
Tags: react
Published: 2021-09-18 08:50:11

I want to suppress the footer permanently when a user navigates to a specific page for my new book (the footer encourages the user to visit this page and would be annoying if on permanently).

I thought it would be relatively easy to count the actual page views (ignoring the  startup execution of the code.)

The view count uses state: 

const [DisplayCount, setDisplayCount] = useState(0); 

But I can't update the value in DisplayCount when the user navigates to the page whatever I try.

There are no buttons involved and a regular function called by the main function will update the value and attempts to return it, but the main function ignores the returned values.

from Chrome DevTools...
Function  - DisplayCount after increment = [1]
Function  - Returning [1]

MAIN  - Function returned DisplayCount = [0]
 
It is such a simple thing, but I have spent 2 days on this now and have not got anywhere...

Any suggestions greatly appreciated !

Rapier
React Router with Github Pages 💎
Tags: react, github
Published: 2021-09-18 08:48:44

If you have tried to deploy a **React App** with react-router-dom to github pages, probably you'll hate yourself because it won't work as you expected 😔.

### So what the heck is going on ? why is this happening?

So if you don't know **gh-pages** deploy your **React** App
to this url `http://{username}.github.io/{repo-name}`
and in your App the "**/**" route means this url `http://{username}.github.io/`.

### So one solution for this

is to replace the **BrowserRouter** with **HashRouter**
so instead of this 
![BrowserRouter](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7f23awy9tzhrkkhc7pga.png)
 
do this

![HashRouter](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ch9ms01e0qn12k0w8722.png)
 
Now deploy again your changes with 
`npm run deploy`

Thats it
Increase Traffic On Site
Tags: webdev, beginners, javascript, leadership
Published: 2021-09-18 08:31:37

It’s not enough to produce great content and hope that people find it – you have to be proactive. One of the best ways to increase traffic to your website is to use social media channels to promote your content. Twitter is ideal for short, snappy (and tempting) links, whereas Google+ promotion can help your site show up in personalized search results and seems especially effective in B2B niches.

YouTube is a great resource for driving free organic traffic to your website. Maybe it's because Google loves YouTube, and considering that it's the second most popular search engine in the world, gaining exposure on YouTube could be huge. Create useful tutorials and videos that add an immense amount of value and be sure to link to your content through the description.

Email marketing is a great way to drive traffic to your site or your blog and to promote any offers, but it also means that you need a list to market to. Create a lead magnet and build a sales funnel immediately if you haven't already done so, in order to build up a list that you can eventually market (not spam) any of your offers to.

Building high-quality infographics are simply one form of clickbait. There are loads of clickbait examples that you can utilize, but not all of them are created equal. However, if you can build a great infographic that many people will link to, you can essentially create an automated marketing machine for your site. Ensure you hire a great designer to do this.

Whatever industry you’re in, chances are there are at least one or two major conventions and conferences that are relevant to your business. Attending these events is a good idea – speaking at them is even better. Even a halfway decent speaking engagement is an excellent way to establish yourself as a thought leader in your industry and gain significant exposure for your site.

Finally, it’s up to you to track your results, keep an eye on your analytics and determine where most of your traffic comes from.

When you have a good grasp of the type of sources that drive the highest volume of traffic, and what percentage of that traffic is converting, you’ll know what to invest in. For me, these mentioned tips with a  are the best solution. Double down on what’s already performing.

Recent tweet for the same can be helpful so checkout :
{% twitter 1439142173211910144 %}