teleren/devto huggingface dataset:
Removing elements from an array
Tags: programming, javascript, webdev, 100daysofcode
Published: 2022-09-13 09:33:37

Take an array and remove every second element from the array. Always keep the first element and start removing with the next element.
Example:
Given the array -->  [1, 2, 3, 4, 5]
The result will be --> [1, 3, 5]

```javascript
function removeEl(arr) {
    const newArr = [];
    for (let i = 0; i < arr.length; i = i + 2) {
        newArr.push(arr[i]);
    }
    return newArr;
}

console.log(removeEl([1, 2, 3, 4, 5]));
```
🎨Sass: the style you want, the code you need
Tags: scss, webdev, css, design
Published: 2022-09-13 09:23:46




#### I added the course road map.
[![Course Roadmap](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ro0ca8b5z7t169f1o5w.jpg)](https://miro.com/app/board/uXjVPXQ4nvk=/?share_link_id=333319943899)


---



If you are a developer or web designer, chances are you have heard about Sass at one time or another. Sass is just as easy to use as CSS but includes some additional features that make it even more powerful.

It's time to start the **_Sass series_**. In this first article of the series, we will learn what Sass is and why you need to use it for more efficient web development.

**Sass** is an extension of the CSS language that adds power and flexibility without getting too complicated. It provides **variables, mixins, inheritance**, and other handy tools for making CSS more maintainable. Sass also helps with more advanced features like code organization (partials), data-driven styles (looks), and responsive design.

In this series, we'll be going over the basics of SASS/SCSS. We'll be covering a lot of ground, from basic syntax to more advanced features. So, if you're new to SASS/SCSS or want to brush up on some old skills, this is the series for you.

So let us start with this question

## Should you be using Sass or CSS? 🤔

That’s a question often asked, and one we can answer with a simple **“Yes”**. It all comes down to stylesheets vs preprocessors — and it’s important to get things right. SASS (and its more powerful cousin, SCSS) are writing systems that let you write faster, more flexible, and more maintainable code by way of variables, mixins, and nesting.

SASS was designed by Hampton Catlin and Chris Eppstein.
The main goal of SASS is to make it easier for developers to maintain their stylesheets and also to help them avoid some common coding problems.

This code, for instance, creates a set of classes twice: once using CSS and once with SCSS.

![an example of creating a button list twice, once with CSS and once with SCSS ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hs4fz734wnclyekv59vf.png)

Write less and do more with Sass.


That's all about this post for today, in the next article, we will learn how to use sass in your project.

See You ❤

---
Please feel free to reach out to me at [Linkedin](https://www.linkedin.com/ak-ram) if you have any questions.
Laravel - Clear Cache in Shared Hosting Server
Tags: laravel, php, webdev, beginners
Published: 2022-09-13 09:23:05


Shared Hosting is very wired Hosting I have ever used. Because All things are restricted which is required for Laravel Project. You cannot install composer using the command line so you need to upload the whole vendor folder from your local machine. Also, there are many things you cannot do without the support of a Hosting Provider. There are so many restrictions to using Shared Hosting that's why we use  [Self Managed Cloud Hosting using ServerAvatar](https://bit.ly/3xJk5k8).

If you want to clear cache in Laravel which is hosted on Shared Hosting then this article will help you to clear cache in a shared hosting server.

## Laravel - Clear Cache in Shared Hosting Server

There are different methods to clear cache in Shared Hosting Server.

### 1. Laravel - Clear Cache in Shared Hosting Server using Web Routes

```php
 //Clear route cache
 Route::get('/route-cache', function() {
     \Artisan::call('route:cache');
     return 'Routes cache cleared';
 });

 //Clear config cache
 Route::get('/config-cache', function() {
     \Artisan::call('config:cache');
     return 'Config cache cleared';
 }); 

 // Clear application cache
 Route::get('/clear-cache', function() {
     \Artisan::call('cache:clear');
     return 'Application cache cleared';
 });

 // Clear view cache
 Route::get('/view-clear', function() {
     \Artisan::call('view:clear');
     return 'View cache cleared';
 });

 // Clear cache using reoptimized class
 Route::get('/optimize-clear', function() {
     \Artisan::call('optimize:clear');
     return 'View cache cleared';
 });
```
### 2. Laravel - Clear Cache in Shared Hosting Server using Task Scheduling (Cronjob)

If you want to run it automatically at a specific time then you will have to set up cronjob first.

Open  `app\Console\Kernel.php` and update the following code:

```php
protected function schedule(Schedule $schedule)
{
    $schedule->command('cache:clear')->hourly();
    $schedule->command('config:clear')->hourly();
    $schedule->command('view:clear')->hourly();
    $schedule->command('route:clear')->hourly();
    $schedule->command('optimize:clear')->hourly();
}
```

You can set any cronjob schedule. You can refer to [this document](https://laravel.com/docs/9.x/scheduling#schedule-frequency-options)  for the task scheduling in laravel. Also, You need to refer to the documentation of the Hosting Provider to Set Cronjob.

For cPanel, You can refer to  [this article](https://blog.cpanel.com/how-to-configure-a-cron-job/?ref=techvblogs.com)  to set Cronjob in cPanel.

**Thank you** for reading this article.
Law assignment help include several things to keep in mind
Published: 2022-09-13 08:39:52

[Law Assignments Help](https://www.greatassignmenthelp.com/law-assignment-help/) experts start to write the paperwork in a simple language like students can easily understand the paperwork. Therefore they do have not any extra time so experts are writing the paperwork like students understand the content at the same time. Law is a vast subject that is taken to time gain expertise. They do not have to be hard on the work themselves. That immediately includes some essential terms in the coursework to avoid legal terms. That will make the whole task easier with the probe May not even need to get the law assignment help from the peer group.
3 steps to develop your custom blogging platform
Tags: programming, javascript, tutorial, beginners
Published: 2022-09-13 08:32:45

**Under the Hood**
From developing an editor to storing data in a database and fetching data on the website in these 3 steps we can build our own blogging platform.

Here are the steps -

## 01
Editor — Develop an editor to write your content. You can use Editorjs, Draftjs or even the UI libraries such as Material UI, and Mantine dev they provide Rich text editors.

[Youtube video](https://youtu.be/CsMcy9479Ks)

## 02
Database — You can use Firebase, Supabase or even mongo DB to store the data. The data stored can be of any type it can be JSON, Raw data or HTML file or text.

[Short link](https://youtube.com/shorts/zimvcuJoMbg)

## 03
Preview — Last part is to fetch the data and show it. You can use the same Rich text editor or even markdown extension or simply render an HTML file to preview the content.

[Short link](https://medium.com/nerd-for-tech/introduction-to-editor-js-46ec4f49f69)

## Conclusion
That’s for today, until next time, have a good day, people.

Keep developing
Shrey
[iHateReading](ihatereading.in)
Storing Variables in a Laravel App Database
Tags: laravel, database, webdev, php
Published: 2022-09-13 08:30:31

#How I use settings table to manage variables across Laravel app database
While working on Laravel applications that requires a lot of configurations, I had a problem with storing the data in the database 

Do I keep creating new tables anytime I want to store a setting?

Do I keep adding new columns on existing tables to store these variables?

## I then came up with the settings table approach
It's a simple but effective approach. 

I use a table settings to store all details of a variable 

I can query the table to get current value of the variable

I can update the table to store updated value

```php
php artisan make:model Setting -m
//This will create a Setting Model and settings_table migration
```

```php
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Setting extends Model
{
    protected $fillable=['name','slug','value','description'];

    protected $casts=[
        'value'=>'array'
    ];
}
```
The settings table has the following columns
- name : to store the name of the setting item
- slug : to store a unique name of the setting item for querying
- value : to store the value of the setting item
- description : to store details of the setting item

the value column is casted to array; this is to handle setting values that are in an array form

## Querying the table
The settings table is queried either using eloquent or DB facade
```php
//array values
$approved_users=\App\Setting::where('slug','approved_users')->first()->value ?? [];

//integer value
$percentage=\App\Setting::where('slug','percentage')->first()->value ?? 20;

//boolean value
$use_old_process=\DB::table('settings')->where('slug','use_old_process')->value('value') ?? 1;
 ```

##Conclusion
This is how I handle some settings in Laravel applications with a lot of configurations. It is not a standard to be enforced. It solved my problem, it could solve yours 

If you have a better way of storing variables in an application, please leave a comment. 

Cheers 😊
Best Free Resources to Practice Leetcode Effectively!
Tags: leetcode, algorithms, programming, beginners
Published: 2022-09-13 08:21:46

If you have been in the market and looking for a job, I am pretty sure you have heard of [Leetcode](leetcode.com),it's a website to practice data structures and algorithms. In this post I am going to share with you the best resources to practice Leetcode effectively.


## List of Resources

- [Neetcode](neetcode.com)
This website has a free list of practice questions, it also has paid courses for people who are interested.


- [ Sean Prashad Leetcode Patterns List](https://seanprashad.com/leetcode-patterns/)
This website has a list of practice questions with the the most common patterns on Leetcode (I highly recommend learning the most common patterns on Leetcode).


- [Blind 75
](https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-100-LeetCode-Questions-to-Save-Your-Time-OaM1orEU)This is a list of questions that teaches you core concepts and techniques for each category/type of problems. 

Here you have the best free three resources to practice Leetcode effectively. If you want more content like that please consider following me on [Twitter](https://twitter.com/Gilfoyleoffical). Thanks for reading.
Trying to get react flow working
Tags: react
Published: 2022-09-13 08:01:22

I have tried to use the three js files in Basic functionality code at https://reactflow.dev/docs/getting-started/core-concepts/ together with the following index.js code to render what is being rendered at https://reactflow.dev/docs/getting-started/core-concepts/ but all I get is an empty page. What am I missing out on?

import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import Flow from './App';

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(&lt;Flow /&gt;);
Today's Daily Humor For Devs - Daily Developer Jokes
Tags: jokes, dailydeveloperjokes
Published: 2022-09-13 08:00:01

---
title: "Today's Daily Humor For Devs - Daily Developer Jokes"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12589f412c5.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
___Q:___ Why did the angry function exceed the callstack size?

___A:___ It got into an Argument with itself
 -->
Building stupid stuff
Tags: beginners, go
Published: 2022-09-13 06:32:21

## Building stupid stuff

Hi there, you yet non-existent readers 👋🏼

This is actually my 2nd attempt at starting a blog. The last time was over 7 years ago (If you want an intro to [Neural Networks](https://en.wikipedia.org/wiki/Neural_network), then go ahead and visit my [first and last post there](https://ilaif.wordpress.com/2015/02/24/machine-learning-neural-networks-1/)).

A few questions I asked myself when writing this first post:

### Why start a new blog instead of using the existing one?

I guess that it feels better to start with a clean slate. It's always easier when you have no history (Also, I don't really study or practice ML nowadays, so having my first blog post about Neural Networks feels weird to me, but maybe I'll re-post it here later).

### Why write a blog at all?

I've read somewhere that, as developers, we are "life-long learners". Learning all of the time is great, and I feel that sometimes what I learn just piles up in my head and doesn't "process" well enough. I think that writing about things helps with that. I also figured that if I learn something that I didn't find answers to on our incredible Internet, then someone else might benefit from reading about it as well!

Another reason is to get more opinions about what I write and how I write about it; If I learn or build something, and someone has an opinion about it, then all I can do is learn from that and keep being challenged.

### What is this blog even about?

I'm calling the blog "[Build Stupid Stuff](https://buildstupidstuff.com/)" since many of the things we all build are probably a bit "stupid", but for me, they all originated from some need and so I'm hopeful that the name will give me the motivation to share it.

So, I'll be writing about anything that I think might be useful, interesting or that I want feedback on.

To new beginnings! 🍾

![blogging-new.png](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2v9kdeogy1syi6yaq3oz.png)

*(Hint: I really like Golang nowadays)*
Why Has My Website Dropped In Rankings
Tags: website, searchrank, seo, searchengine
Published: 2022-09-13 07:07:34


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/amharbgjt6i01mq6fnkb.jpg)
A website’s ranking can drop for a variety of reasons. In order to diagnose the issue and take corrective action, it’s necessary to understand why the site has lost its ranking. This blog post will explore some potential causes of a rankings drop, as well as some methods that can be used to correct the problem. Keep in mind that there are many factors that contribute to a website’s ranking, and this is by no means an exhaustive list. If your site has experienced a significant drop in traffic or rank, it’s best to consult with an experienced SEO professional for assistance.

Read More - [www.smartmarketers.com.au/website-ranking-dropped/](https://www.smartmarketers.com.au/website-ranking-dropped/)
Tiny Tips : Ordering your inequalities in conditions
Tags: productivity, programming
Published: 2022-09-13 07:06:11

In high school, when you want to indicate x is between 0 and 5, you wrote: 

`0 < x < 5`.

In programming, you end up with:
```
if ( 0 < x && 5 > x )
```
```
if ( x > 0 && x < 5 )
```
```
if ( 0 < x &&
     5 > x )
```

Where it is hard to understand that x should be in the interval [0, 5].

Personally, I always write it like this:

```
if ( 0 < x && x < 5 )
```
Polygon fellowship experience.
Tags: polygon, polygonfellowsip, fellowship, devfolio
Published: 2022-09-13 07:03:11

## Some context
Polygon fellowship is a mentorship program organized by Polygon <> Devfolio. Where you get to work on your side projects with a week long IRL hacker house with other fellows and mentors and a lot of talks form amazing people around the globe.

Nearly 2 months ago I got into Polygon Fellowship builder's tracks for my side project. My initial plan was to build a layer on top of Alchemix protocol to offer what Flint or pillow fund does. But after realizing that it's not a tech problem more of a product problem I ditched this idea and started working on [GitDAO](https://github.com/vivekascoder/git-dao) inspired by a tweet from [Balaji Srinivasan](https://twitter.com/balajis/status/1326313315044192256). In a nutshell it's about a DOA tool that helps you to create economy around your open source projects using DAOs.

![Git DAO homepage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nq6im3ikor3n85x65c6l.png)



## IRL Hacker house
The hacker house was from 30th July to 8th August. At that time I was already in Bangalore so it was a perfect opportunity for me. It was full of networking, talks, food and amazing people. 

![Hacker hall](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sd6c3qwhfmhi4fng9jfh.jpg)

It was fun staying awake at Hacker Hall to build the projects. I My favourite part was fellows because I met a cool people there and definitely had a fun conversation.


![Cold brew](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i7hrbtanxrr5l3jq35tx.png)


## Demo Day
They had a offline demo for the projects we've built during the fellowship, there were some VC from [Builders Tribe](https://buidlerstribe.com/) and Sino Global. It was great seeing other people's progress and pitching to the VCs and getting feedback from them. 

If you're interested you can find my slides on Git DAO from [here](https://www.canva.com/design/DAFIdipnq1A/vtIZF4YKAgKUpvIGhdP47Q/view?utm_content=DAFIdipnq1A&utm_campaign=designshare&utm_medium=link2&utm_source=sharebutton). To follow my progress on Git DAO you can follow [me](https://twitter.com/0xStateMachine).

At the end of fellowship we also had an after party where I found other familiar faces outside of the fellowship it was definitely a day to remember.
I broke my thumb, and I learned about Adaptability
Tags: management, softskills, adaptability
Published: 2022-09-13 06:57:52

The last week I was reading about: **ADAPTABILITY**, I was trying to understand the meaning of this word, and the following quote was very interesting for me

> “the change is the only constant in our lives.”

I read about **the change**, it is uncomfortable, it is unfamiliar, and some times it scary us, and this is normal, this is ok.

I was imagine different scenarios about how to incorporate the adaptability in my life, _“What if the project assign change?”, “What if some team members change?”_ but, I did not see what was about to happen.

---

### A change was coming
The thing is, I like to play soccer, the past week I was playing with friends, well, the ball hit my fist, breaking a thumb on my left wrist, I could not believe it, I’m a software engineer, and I can not use my computer for a while!

The following day I knew that I require surgery, and it means some rest after that.

I was with something really different and new, something perfect to try to adopt this new word: **ADAPTABILITY**

---

## What I learned from this accident?

### 1. You can not control everything, and this is ok
Sometimes we think that we are irreplaceable, and we force us to do things because “who else is going to do this?”, but if something like this happens, we understand that at the end of the day someone else can replace what you do, sorry but this is true

Always I’m going to do my best, but understanding that I need to be fine to work, I need to take care of myself to add all the possible value to my company

### 2. We work with people, we are not machines
I work in a company with amazing people, when I talked with my boss, her firsts questions were “how do you feel? are you ok?”, in a business with a high rush and filled of higher priorities to complete, feels very good to be involved with people that makes me feel good, people that take cares of me as a person, more than an engineer.

Also, this makes me understand that this kind of accidents occurs, and we should understand and support people when this happens.

### 3.Positivity
I read from a book the following text:

> You can hear from many different channels that you should see things as a Challenge and not as a Problem

When I was in front of this scenario, I was trying to identify what can I get from this as a Challenge, and the result was clear for me, I’ll use this time to study some pending things and see a couple of courses that I did have time before.

I mean, probably this is not a **“big Challenge”**, but In my scenario I only have two options, try to fix this and work with that I had, or just sit to re think “why did that happen to me?”.

---

Today I’m recovering from the surgery, taking some time for me. I’m reading, learning, watching some courses, and also, using this time to think about how lucky we are every day
What is Amazon EKS Connector ?.
Tags: aws, kubernetes, beginners, devops
Published: 2022-09-13 06:48:12

You can use `Amazon EKS Connector` to register and be a part of any conformant Kubernetes cluster to AWS and visualize it in the Amazon EKS console. You can see the status, configuration, and workload in the Amazon EKS console after a cluster is connected. You can use this feature to view connected clusters, but you can't control them.


![EKS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jc01ym98i81b5a9c2z0w.jpg)

The Amazon EKS Connector can connect the following kinds of Kubernetes clusters to Amazon EKS. The Amazon EKS Connector is also an open supply project on Github. 

- The clusters are on-premises.
- There are clusters on Amazon Elastic Compute Cloud.
- Other cloud providers have managed clusters.



## Amazon EKS Connector considerations

Understand the following before using Amazon EKS Connector:


- You should have `administrative privileges` to the Kubernetes cluster to join the cluster to Amazon EKS.
- Before connecting, the cluster must have Linux worker nodes present. ARM worker nodes aren't supported.
- Outbound access to the `ssm.` and `ssmmessages` is required for you to have worker nodes in your cluster.
- Up to 10 clusters can be connected by default. The service quota console can be used to request an increase. 
- Only the Amazon EKS `RegisterCluster`, `ListClusters`, `DescribeCluster`, and `DeregisterCluster` are supported by external Kubernetes clusters.
- Permissions are needed to register a cluster.

1. eks:RegisterCluster
2. ssm:CreateActivation
3. ssm:DeleteActivation
4. iam:PassRole

- Permissions are needed to deregister a cluster.

1. eks:DeregisterCluster
2. ssm:DeleteActivation
3. ssm:DeregisterManagedInstance

## Required IAM roles for Amazon EKS Connector

The following two roles are required for using the Amazon EKS Connector.

- The service-linked role of amazon EKS connector is created when you register the cluster.
- The agent IAM role of Amazon EKS Connector have to be created manually.

To enable cluster and workload view permission for another user, you must apply the `eks-connector` and Amazon EKS Connector cluster roles to your cluster. 


Thanks for reading my article till end. I hope you learned something special today. If you enjoyed this article then please share to your friends and if you have suggestions or thoughts to share with me then please write in the comment box.

Follow me and share your thoughts,
[GitHub](https://github.com/MakendranG)
[LinkedIn](https://www.linkedin.com/in/makendran/)
[Twitter](https://twitter.com/MakendranG)