teleren/devto huggingface dataset:
💬 Дейлики — это фигня?
Tags: management, startup, productivity
Published: 2023-10-13 17:28:39

Дело вот в чем: я сам бесконечно устаю от "созвонов". Не люблю их проводить, не люблю слушать всякую дичь, которая не имеет ко мне никакого отношения, с трудом вспоминаю их результаты через какое-то время. Еще хуже то, что время таких встреч не всегда удобно персонально мне, не хочется выходить из "потока", переключаться и так далее. В общем, дейлики/синки/стендапы в этих ваших Slack/Google Meet — тотальная хрень (в большинстве случаев). 

И что с этим можно сделать? Где-то полтора года назад я попробовал дейлики в текстовом формате. Суть в следующем: в назначенный час в групповой чат кто-то отправляет некий "daily message", а товарищи в тред рассказывают о том, как у них дела. Вы не поверите, но это работает и работает отлично. Теперь я могу ответить в удобное время, собраться с мыслями, проанализировать и вспомнить всю проделанную за день работу. Это уже продуктивно. Но я программист, а это значит, что подобную рутину надо автоматизировать. Без проблем! Написал простенький скрипт, который отправляет это системное сообщение в назначенный час. Еще лучше, не правда ли? И никакой магии, все предельно просто. Но чего-то не хватает... Поиск по чату через месяц-два перестает быть удобным, а значит надо все это логгировать в единую историю и разбивать по датам. Без проблем, теперь скрипт все реплаи отправляет на специальную страничку в Notion.

Получилась крайне полезная автоматизация: действительно продуктивные дейлики в удобное время + ведение истории реплаев, по которой можно ориентироваться и проанализировать проделанную работу, проблемы и трудности с которыми сталкивалась команда. И этот потрясающий опыт я со своими товарищами [реализовал в виде тестового бота DailyLog](https://dailylog.denostep.dev/) (пока в состоянии тестирования, только для телеги). Попробуйте, протестируйте, оцените данный формат ведения ежедневных встреч и расскажите о вашем опыте мне [@itnigilist](https://t.me/itnigilist) или в комментах под этим постом. 

🔥🔥🔥 Важно: расскажите про это вашим друзьям, коллегам. Я уверен, что многие будут рады пересмотреть классический формат и повысить свою продуктивность!
Only good developers make bad UI
Tags: ui, webdev, css, javascript
Published: 2023-10-13 17:16:27


### Do you know Developers are competing to make the worst user experience possible


![Worst UI Competition](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/10o5zrtzshs1jblek6a5.png)


#### Check out some best bad UI created by experienced programmers.

---

{% twitter 1712528404761973028 %}

---
---


##### Thank you ❤❤
The Journey of Refactoring: Enhancing Code, One Step at a Time
Published: 2023-10-13 17:10:28



Refactoring is often seen as a daunting task, but it's also an essential aspect of software development. Today, I'll share my experience on the journey of refactoring a particular project and the lessons I learned along the way.

## The Motivation

Every developer knows the feeling: you look back at old code and wonder, "What was I thinking?" While the initial implementation might have worked, over time, as requirements change and new features are added, the structure might no longer be ideal. That was the situation I found myself in.

## Focus Areas in Improvements

1. **Separation of Concerns:** My primary goal was to segregate functionalities into understandable chunks. For instance, I split the main functionality into two separate files: `argparser.py` for argument parsing and `converter.py` for conversion processes.
2. **Class Structure:** To handle different file formats, I introduced two classes: `TxtConverter` and `MdConverter`. This allowed for a clear differentiation in logic and operations for `.txt` and `.md` files.

## Steps to Better Code

- **Code Duplication:** Repeated chunks of code were the first targets. By extracting them into separate classes, the code became DRY (Don't Repeat Yourself).
- **Variable Naming:** Clear and descriptive variable names can make code self-explanatory. Several variables got renamed to reflect their purpose better.
- **File Separation:** Splitting the main code into separate files made it easier to locate functionalities and maintain the code.

## The Interactive Rebase Adventure

Using Git's interactive rebase was like wielding a double-edged sword. It's powerful, but if misused, it can rewrite history in unwanted ways. My experience was smooth, though. I could squash some minor fixes into relevant commits, ensuring each commit was atomic and self-contained.

## Bugs and Breaks

While refactoring, I did stumble upon a few overlooked bugs. This was a silver lining, as the process of refactoring indirectly led to more robust code.

There were instances where changes led to unexpected behaviors. This underscores the importance of thorough testing after each significant refactor.

## Rewriting Project History with Git

Git, as a version control system, is an ally of the developer. While using Git to change the project's history, I realized the importance of clear commit messages. They acted as breadcrumbs, guiding me through the changes made and the reasons behind them.

## Conclusion

Refactoring isn't just about cleaning up code. It's a process of revisiting decisions, understanding the current state of the project, and making informed choices to improve it. Through this journey, I not only enhanced the codebase but also grew as a developer, understanding the nuances and importance of maintaining clean and efficient code.
Hacktoberfest23 Pledge
Tags: hacktoberfest23, hacktoberfest
Published: 2023-10-13 17:00:57

I will like to successfully start my open source journey with this edition of Hacktoberfest. I am excited to participate in Hacktoberfest and embark on my open source journey. This edition of Hacktoberfest presents a wonderful opportunity for me to contribute to the open source community and make a meaningful impact. I am eager to learn, collaborate, and hone my skills while working on interesting projects.

During this Hacktoberfest, I aim to explore various open source projects and find ones that align with my interests and expertise. Whether it is contributing code, fixing bugs, improving documentation, or suggesting new features, I am ready to roll up my sleeves and dive into the world of open source.

I believe that open source is not just about writing code; it is about fostering a spirit of collaboration and innovation. By joining this global event, I hope to connect with like-minded individuals who share a passion for technology and a commitment to making the world a better place through open source contributions.

I am grateful for the opportunity Hacktoberfest provides to learn from experienced developers and receive feedback on my work. I understand that open source is a community-driven effort, and I am excited to be a part of this vibrant community. I am confident that this journey will not only enhance my technical skills but also help me grow as a developer by exposing me to different perspectives and approaches.

As I begin my open source journey with this edition of Hacktoberfest, I am filled with enthusiasm and determination. I am ready to embrace challenges, overcome obstacles, and make a positive impact on the open source projects I contribute to. I look forward to the rewarding experiences, knowledge sharing, and personal growth that lie ahead.

Let's dive into #Hacktoberfest together and make this edition a memorable one!
Recontextualize to Remember
Tags: beginners, codenewbie, learning, motivation
Published: 2023-10-13 17:00:39

Diving into the world of web development has been the dumbest thing I've ever done.

As in, learning to program and code is outside my wheelhouse, making me feel dumb on a regular basis-- not that the field itself isn't a smart move. (I believe it is! That's why I'm trying!)

It feels like such an uphill climb to get a point down, only to later forget any understanding. It happens so easily. It happens often.

Is it because I'm not passionate enough? Is it because I don't _love_ this stuff?

Eh, neither of those matter. 

I've gotten a lot of peace of mind once I accepted that I _will_ forget, and that's part of the process. Maybe not so much for the hardcore, but it's my process anyway.

No need to learn things perfectly. No need to spend so much effort trying to remember. It's less pressure that way. And it makes the second (or third or fourth or fifth or sixth) round of re-learning much easier.

Now on to the real purpose of this post: writing down another aspect of learning that makes things easier.

I was listening to HTML All The Things, their JavaScript Basics episode as a refresher. 

{% embed https://open.spotify.com/episode/5QGUEIUOrpcTG7fSfNEVtL?si=AWWLcSbOSnKELZFuavNPyQ %}

And they were going through the differences of using `var` vs `let` and `const`. A staple of JS understanding. Something you should know for an interview.

Something that I've learned and forgotten frequently. I get reminded of its importance when my code breaks, basically. Or when something is/isn't hoisting properly.

And as much as I can read through the differences of global and local scope, even with due diligence and note taking, I'm still going to forget.

But in that episode, when talking about global scope, they used an example that registered so well with me: dark mode. 

> Global can be accessed anywhere in the program. You might have something you want the entire program to know, such as the light and dark theme.

Because duh. Of course you would want that toggle across the board and not limited to a single page.

It seems so obvious, but I never had global as a concept click so well until now. Moving forward, when I distinguish between global and local, I can always think back to dark mode.

What other aspects like dark mode would I need the entire program to know?
Badam During Pregnancy
Published: 2023-10-13 16:58:18

However, it's important to consume almonds in moderation. A handful of almonds a day (around 1 ounce or 28 grams) is typically a safe and nutritious amount. Overconsumption of almonds or any other nuts can lead to excessive **[Badam During Pregnancy](https://messymothers.com/badam-during-pregnancy/)** calorie intake. If you have concerns or dietary restrictions during pregnancy, it's advisable to consult with a healthcare provider or a registered dietitian. They can provide personalized recommendations to ensure you're meeting your specific nutritional needs and addressing any potential allergies or intolerances.
Today's LeetCode's challenge 2023/10/13
Tags: leetcode, coding, go, dp
Published: 2023-10-13 16:52:42

---
title: Today's LeetCode's challenge 2023/10/13
published: true
description: 
tags: #leetcode #coding #go #dp
cover_image: https://repository-images.githubusercontent.com/408927712/1c5ce46e-266f-43f0-b543-75bf341239b5
# Use a ratio of 100:42 for best results.
# published_at: 2023-10-13 16:10 +0000
---

This write-up refers to LeetCode's daily challenge [746. Min Cost Climbing Stairs](https://leetcode.com/problems/min-cost-climbing-stairs/description/?envType=daily-question&envId=2023-10-13)

Even though this challenge is labeled as easy, I couldn't solve it by myself because I still need to improve my dynamic programming skills. So, if you find yourself in the same situation, I'll try to help you model this challenge.

The challenge asks you to calculate the minimum total cost to climb a staircase. You are given a list of costs as an array of integers, where each cost is the cost of a step. You can either climb one or two steps at a time. 

In this case, we can utilize dynamic programming to determine the minimum cost to reach each step. The key concept you need to keep in mind to solve this challenge is:
> At each step, the total cost to reach the current step is calculated as the minimum between the cost of the previous step and the step before that. 

Translating this logic into code will result in the following snippet
``` go
// ...
for i := 2; i <= len(cost); i++ {
    oneStepBack := oneStepBackTotalCost + cost[i-1]
    twoStepBack := twoStepBackTotalCost + cost[i-2]
    minTotalCost = min(oneStepBack, twoStepBack)
    // ...
}
```

Now, only two things remain to finish the code:
 - Initialization of the variables
 - The update of `oneStepBackTotalCost` and `twoStepBackTotalCost` after each step

#### Initialization of the variables
Before entering the loop, no cost has been accounted yet. Therefore, we can initialize the variables to 0

``` go
minTotalCost, oneStepBackTotalCost, twoStepBackTotalCost := 0, 0, 0
```

#### The update of `oneStepBackTotalCost` and `twoStepBackTotalCost` after each step
This is the tricky part.
Since we are about to climb the next step, the cost to reach the current step will become the cost to reach the previous step in the next iteration. Hence, the cost to reach the previous step will become the cost to reach the step before that.
``` go 
twoStepBackTotalCost = oneStepBackTotalCost
oneStepBackTotalCost = minTotalCost
```

After finishing the loop, the minimum total cost will be stored in the variable `minTotalCost`. Return that, and the challeng is solved.
Here is the code:

``` go
func minCostClimbingStairs(cost []int) int {
	minTotalCost, oneStepBackTotalCost, twoStepBackTotalCost := 0, 0, 0

	for i := 2; i <= len(cost); i++ {
		oneStepBack := oneStepBackTotalCost + cost[i-1]
		twoStepBack := twoStepBackTotalCost + cost[i-2]
		minTotalCost = int(math.Min(float64(oneStepBack), float64(twoStepBack)))

		twoStepBackTotalCost = oneStepBackTotalCost
		oneStepBackTotalCost = minTotalCost
	}

	return minTotalCost
}
```

Thanks for reading this post! I appreciate any suggestions and improvements!
Day 68: Smile Please
Tags: webdev, frontend, 100daysofcode, css
Published: 2023-10-13 16:36:39

## Question
Create an HTML and CSS code snippet that should show below Smile emoji


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezws3gsombt7y8jqlmxm.png)





Check the comment below to see answer.
Making a custom 404 page in Next.js
Tags: nextjs, 404, react, custompag
Published: 2023-10-13 16:35:25

## Next.js 13.3: Automatic Handling of Unmatched Routes with not-found.js
**Introduction**
_In the fast-paced world of web development, Next.js continues to evolve and improve. With the release of <u>Next.js 13.3</u>, a new feature has been introduced that simplifies how you handle unmatched routes in your application. This feature makes it even more developer-friendly and streamlines the process of creating a custom 404 page. In this blog post, we'll explore these changes and how you can take advantage of them._

**The Not-Found Page in Next.js**
_With Next.js 13.3, managing custom 404 pages and handling unmatched routes has become remarkably more straightforward. All you need to do is change the file name to `not-found.js`. An `app/not-found.js` file will now automatically handle visits to a URL that does not have a matching route in your app._

_You can find detailed information about this file convention in the [Next.js documentation](https://nextjs.org/docs/app/api-reference/file-conventions/not-found)._

_This exciting update was officially announced in the [Next.js 13.3 release notes](https://nextjs.org/blog/next-13-3)._

---

> **Important Note:** _While Next.js 13.3 simplifies the process of handling unmatched routes, there's a crucial detail to be aware of. The `not-found.js` file currently only renders when triggered by the `notFound` function. However, the Next.js team is actively working on adding support for automatically catching unmatched routes, making it even more seamless. To take advantage of the current functionality, ensure that your custom 404 page is named `not-found.js` instead of `404.js`._

---

_In the meantime, as it looks like dynamic routes are resolved after static routes, you can solve it by creating a [dynamic catch-all route](https://beta.nextjs.org/docs/routing/defining-routes#catch-all-segments) using a `[...not_found]` folder and add it to your app folder._

**Here's how you can do it:**

![folder structure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v4ee28487p9oiycj6srr.png)

_Inside the dynamic route folder add a `page.js` file that calls the `notFound()` function._

**app/[...not_found]/page.js**

```
import {notFound} from "next/navigation"

export default function NotFoundCatchAll() {
  notFound()
}

```
_And inside the `not-found.js` file in the root of your app folder you can add your custom 404 page._

**app/not-found.js**

```
import Link from 'next/link'

export default function NotFound() {
  return <div>
      <h1>Not found – 404!</h1>
      <div>
        <Link href="/">Go back to Home</Link>
      </div>
  </div>
}
```
_Please note that this approach can potentially create problems if you have multiple dynamic routes in your app folder. However, if you have dynamic routes in another static folder, you should be able to use this approach without issues._

**_Happy coding with Next.js!_**
jq, reduce, inputs & null input
Tags: jq
Published: 2023-10-13 16:22:44

Say you have a file (e.g. `numbers.txt`) with one number per line and you need to sum them all up.

```
1
2
3
```

First off, for such a simple task and such a small file you can always do:

```
# jq -s 'add' numbers.txt
6
```

In case you wonder: `-s` causes the file to be loaded into an array which is then passed to `add`. So essentially what's happening is `[1,2,3] | add`.

However for the purpose of this post, we're going to use `reduce` & friends:

```
# jq -n 'reduce inputs as $n (0; . + $n)' numbers.txt
6
```

The `-n` option is quite important here and is something that has tripped me up way too many times that I care to admit. 

But before I explain what `-n` means, let's see what running the same command without it yields:

```
# jq 'reduce inputs as $n (0; . + $n)' numbers.txt
5
```

Obviously wrong and we can guess that the first input (i.e. the first line of the file) has gone AWOL. (Another thing I wasted way too much time on.)

The clue is in the doc for `inputs`:

> Outputs all remaining inputs, one by one.

So how do I get the first input? With `.` of course:

```
# jq 'reduce inputs as $n (.; . + $n)' numbers.txt
6
```

So `.` holds the first line of the file whilst `inputs` holds the remaining ones.

However sometimes the initialisation sequence of a reducer is similar to the iteration sequence e.g.,

```
# jq 'reduce inputs as $n (. * 10; . + ($n * 10))' numbers.txt
60
```

Again, this is a simple and contrived example so it's probably ok to repeat yourself here but there's a way to have the entire file emitted by `inputs`. That's where `-n` comes in:

> Don't read any input at all. Instead, the filter is run once using null as the input.

So `-n` causes `null` to be emitted as the first input, which means that `1` and all the remaining numbers are emitted by `inputs`:

```
# jq -n 'reduce inputs as $n (0; . + ($n * 10))' numbers.txt
60
```

The `-n` is often useful when you just want to try out some stuff quickly e.g.,

```
# jq -n '[1,2,3] | add'
6
```
Fixed the system straight up dates and information management
Published: 2023-10-13 16:22:18

I'm move out my property and in the process of getting the system fixed and management all accounts that I owned every year of 2020 and empower them to make it better to maintain management to the system straight up dates and information from the question and answer the system of management President CEO manager to date the change of the willing time 9:20fri,oct13, 2023 today date   .                
 jerardo aguiniga Cervantes
Thanks you
PHP Array
Tags: webdev, javascript, tutorial, php
Published: 2023-10-13 16:13:05


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r4dz4ol8tcnvn0hjj3zp.jpeg)

In PHP, there are three types of arrays:
1. Indexed arrays - Arrays with a numeric index
2. Associative arrays - Arrays with named keys
3. Multidimensional arrays - Arrays containing one or more arrays.
#halflearning #PHP #HTML #Css #Javascript #webdevelopment
Token authentication in Django Rest Framework
Tags: react, django, api
Published: 2023-10-13 15:57:21

Token authentication refers to exchanging username and password for a token that will be used in all subsequent requests so to identify the user on the server side.

#### settings.py
```python
INSTALLED_APPS = [
    .
    .
    
    '<your_app_name>',
    'rest_framework',
    'corsheaders',

    'rest_framework.authtoken' #new
]

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework.authentication.TokenAuthentication',
    ],
}
```

#### views.py
```python
from rest_framework.views import APIView
from rest_framework.decorators import api_view
from rest_framework.authtoken.models import Token
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from rest_framework.response import Response
from django.contrib.auth.hashers import check_password

@api_view(['GET'])
def getData(request):
    users = User.objects.all()
    users_serializer = MyUserSerializer(users, many=True)
    return Response(users_serializer.data)

class TokenAuthentication(APIView):    
    def post(self, request, format=None):
        data = request.data
        if('username' in data):
            try:
                user = User.objects.get(username=data['username'])
                checkPassword = check_password(data['password'], user.password)
                if(checkPassword):
                    #If token is not created, the following will create a new token for the user instance.
                    token,created = Token.objects.get_or_create(user=user)
                    token_data = {
                        "user_id": user.id,
                        "token": token.key
                    }
                
                    return Response(token_data)
                else:
                    return Response("Password is incorrect.")
            except ObjectDoesNotExist:
                return Response("Invalid user details")
        else:
            return Response("Please fill the form.")
```


#### urls.py
```python
from django.urls import path
from . import views

urlpatterns  = [
    path('', views.getData),    
    path('token_auth/', views.TokenAuthentication.as_view())

]
```

#### serializers.py
```python
from rest_framework import serializers
from django.contrib.auth.models import User

class MyUserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = "__all__"
```

### Output

![postman output img](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/izcp5aa1tgkbrwl8m74g.png)
Best CV Writing Service
Published: 2023-10-13 15:46:17

Seeking the best CV writing service? Your pursuit comes to a close here. Uncover the transformative potential of a winning CV with UK's [Best CV Writing Service Bristol](https://professionalcv.uk/cv-writing-service-bristol/)! Elevate your job hunt with our expertly composed CVs. Harnessing our profound comprehension of the competitive job arena, we tailor CVs that seize employers' attention. Nonetheless, our assistance goes beyond CVs. Delve into our website to discover CV samples encompassing a wide array of professions, spanning from educators to engineers and beyond. Set off on your voyage to professional accomplishment with our meticulously arranged selection of services.

Your journey toward career evolution starts now. If you need any help Contact us.
Phone: +44 7537143079
Email: info@professionalcv.uk
Untitled
Published: 2023-10-13 15:39:45

>Some tired arround with me now,I want to go sleeping for a moment, however, i cann't, i have to persevere. It have occured many times that i give up my target. I have lost track of how many time this is and i hope it is for the last time. I know a point clearly about me that I don't have enough self-control, however, i have to over it.
I want to become a person who is handsome and erudite. I believe this time will be like the time that I began to make my mind on studying computer when i was a sophomore. I will keep it up. Today is day three.