teleren/devto huggingface dataset:
March 31st, 2022: What did you learn this week?
Tags: discuss, weeklyretro, weeklylearn
Published: 2022-04-01 00:40:26

It's that time of the week again. So wonderful devs, what did you learn this week? It could be programming tips, career advice etc.

<center>

![Image of the brain](https://media.giphy.com/media/ojmB7lOn3VUU8/giphy.gif)
</center>

Feel free to comment with what you learnt and/or reference your TIL post to give it some more exposure.

{%tag todayilearned %}
<!--
And remember, if something you learnt was a big win for you, then you know where to drop it as well.👇👇🏻👇🏼👇🏽👇🏾👇🏿

{%link https://dev.to/devteam/what-was-your-win-this-week-1oih %}

<center>

![Little kid making a fist as if to say "Yes!"](https://media.giphy.com/media/6brH8dM3zeMyA/giphy.gif)
</center>
-->
How to Save Your Hashnode Articles to GitHub
Tags: hashnode, github, crosspost
Published: 2022-04-01 00:31:01

---
title: How to Save Your Hashnode Articles to GitHub
published: true
date: 2022-04-01 00:20:22 UTC
tags: #hashnode #github #crosspost
canonical_url: https://blog.seancoughlin.me/how-to-save-your-hashnode-articles-to-github
---

## Hashnode is Great But Protecting Your Stuff is Important

Hashnode is my favorite blogging platform. I enjoy the slick interface, developer focus, custom domain names, and outside integrations.

Perhaps the best feature of Hashnode is the markdown editor. It makes writing stories a breeze. You can even use Hashnode as a full-stack solution and store your articles there.

However, as much as I enjoy Hashnode, it could fold one day. Or they could be hacked, or their servers could flood, or catch on fire, or... I think you get the point. Hosting all your content on Hashnode is a dangerous proposition.

Thankfully, owning the writing you produce is a crucial feature of Hashnode. The service makes it easy to connect to GitHub for automatic backups. They even recently released a [new feature that makes it super easy to backup all your old content to GitHub](https://engineering.hashnode.com/serverless-github-backups). Having a backup means that in the off chance something happens to Hashnode, you have the resources to recover.

## How to Setup Github Backups

1. First, you will need to create a [new repository](https://github.com/new/) on GitHub. You can title the repo whatever you'd like.
2. Head over to your blog's dashboard.
3. Locate the Backup backup button on the side panel.
4. Click on the install _Hashnode GitHub App_ link. ![Hashnode GitHub App link](https://cdn.hashnode.com/res/hashnode/image/upload/v1648771709451/MqU1ZoFcV.png)
5. Provide the app permission to access only select repositories. Then select the repository you created in step one. ![Select the one repo you would lie to backup to](https://cdn.hashnode.com/res/hashnode/image/upload/v1648771723364/ZwNSg0g32.png)
6. Hashnode will now automatically backup your articles upon publishing. You can also click _Back up all my posts_ to backup old posts. ![Automatic backup of all your posts](https://cdn.hashnode.com/res/hashnode/image/upload/v1648771746435/kKCDZlCSU.png)

_That's it!_ You now have all your old posts saved to GitHub. What happens if GitHub goes down? That's too scary a possibility to consider.

## Sources

[https://support.hashnode.com/docs/github-backup](https://support.hashnode.com/docs/github-backup)

[https://engineering.hashnode.com/serverless-github-backups](https://engineering.hashnode.com/serverless-github-backups)
Present like a boss with transcription and analytics based on Deepgram
Tags: hackwithdg
Published: 2022-04-01 00:14:46

### Introduction

I learned about Deepgram from the hackathon on DEV. I had not heard of them prior. After reviewing their docs, it seemed to make speech to text much easier to adopt than some other services. Other services seem complex to build upon and building simple uses would take a long time. Deepgram seems like it could shorten development of simple use cases.

### My Deepgram Use-Case

Have you ever heard of someone giving a talk or a presentation and been impressed with their ability to present? You may have noticed they did not use filler words like "umm", "so", "and", etc.

Think about the last time you heard a presentation and the speaker used these filler words frequently. Did you find the presentation hard to follow? Did the filler words seem to get louder and louder?

Organizations like Toastmasters count how many filler words people use in their presentations. What if you could practice a presentation with an app and it would give you stats on filler words?

What if the app could give you a score on sentiment? What if it could tell you how well your presentation would be received?

### Dive into Details

The app would Deepgram's text to speech. Either the prerecorded or live streaming options would work.

Initially, the app would count filler words. The app would give statistics per presentation and over time. Whenever the number of filler words drops by every 10%, the presenter would get a badge. Another badge would get a special badge when they present without any filler words.

Based on this Deepgram [tutorial](https://developers.deepgram.com/use-cases/talk-time-analytics/), the app could provide statistics on total pause time per presentation and even pauses between words. The app could suggest optimal pause lengths and frequency for a good presentation.

Another feature would be add give statistics similar to reading level. Once the presentation is text form, the text could be analyzed for reading level. The average reading level would be provided and specifics for each sentence. The assumption is that the reading level would indicate what type of audience would be able to understand the presentation. A high reading level would indicate that the presentation is meant for expects, while a lower reading level would indicate a general audience. A presentation with the lowest reading level might be best appropriate for children.

The apps analytics will evolve based on presentation best practices and user feedback.


### Conclusion

Deepgram's text to speech API seems to make transcriptions and analyzing the speech much easier than other platforms. Their capability can be used to help individuals improve their presentation and speaking skills by providing meaningful statistics and recommendations.

<hr>

Photo by <a href="https://unsplash.com/@xteemu?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Teemu Paananen</a> on <a href="https://unsplash.com/s/photos/presentation?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Criando um Downloader de MP3 - Python
Tags: beginners, python, programming, tutorial
Published: 2022-04-01 00:00:37


Primeiro você terá que instalar a biblioteca pytube se não estiver instalado.

```
pip install pytube3 -U
```
Criação do Downloader:

- importar a biblioteca pytube.

```
from pytube import YouTube
```
- Criar as funções do downloader.

```
link = input('Insira a url: ')
yt = YouTube(link)
msc = yt.streams.get_by_itag(140)
msc.download()
print('Download feito com sucesso!')
```
 Código completo:

```
from pytube import YouTube

link = input('Insira a url: ')
yt = YouTube(link)
msc = yt.streams.get_by_itag(140)
msc.download()
print('Download feito com sucesso!')
```
 
Referências:
[https://github.com/hbmartin/pytube3](url)
Exemplos de uso da api do cpanel
Tags: php, shel, cpanel
Published: 2022-03-31 23:53:19

Bom, quando trabalhei num sistema distribuído, precisávamos criar subdomínios, databases e várias outras coisas em real-time para cada cliente especificamente, então criei um shell script para automatizar as tarefas.

{% embed https://gist.github.com/xxdannilinxx/36f5acb54da65701658f35a952baa530 %}

Deixo acima alguns endpoints da versão v2 da api do cpanel que me ajudou bastante na automatização.

## Referências
[cpanel api docs](https://api.docs.cpanel.net/cpanel/introduction)
Getting Started With Python PyStart(Variables)
Tags: python, datascience, machinelearning
Published: 2022-03-31 23:49:58

**1.0 VARIABLES**
Variables are containers for storing data values. Python has no command for declaring variable. A variable is created the moment you assign a value to it.
For example,

```
x = 4;
```

```
y = "Davis"
```

To display the result of this, We make use of the print() built-in function;

```
print(x)
```

```
print(y)
```

**Output**
`4`
`Davis`

**Note:**
In Python, we do not have to say x = int 4; just as we have in other programming languages like Java, Python automatically detects the data type of the value)

**Also,** when declaring variable names, we take note of keywords, there are some reserved keywords in python that shouldn't be used as a variable name, some of such keywords includes **return**, **is**, **continue**, **def**, **finally**, and a few other words. Read further on Python keywords  [Click here for Python keywords](https://docs.python.org/2.5/ref/keywords.html)

**1.1 Checking the data type of the variable**
It is important that we know how to check data types in Python, this is a basic concept that will come in handy when we get to more advanced topics like Data Preprocessing and Analysis. 
We check the type of our data by using the type() method.

```
print(type(x))
```
```
print(type(y))
```
**Output**
`int`
`str`

**1.2 Python Variable Naming Rules**
The following are the some good, bad and different naming conventions. 
The Good shows some good naming conventions that can be used and that is accepted by developers.
The Bad shows some bad practices that shouldn't be used while coding. 
The Different shows that each individual variable is independent of the others, they all have the same spelling but the fact that some are capital letters and some aren't. They are all different.

```
Good: spam  eggs  spam23  _speed
```

```
Bad: 23spam  #sign   var.12
```

```
Different: spam   Spam   SPAM
```
1st Attempt at Marketing - New Years Resolution - Dev Log 27
Tags: webdev, beginners, startup, nextjs
Published: 2022-03-31 23:25:24

If you have been keeping up with this blog series at all you will know I just finished my first product, a job board (consolejob.com). As of today, I have failed my first attempt at marketing. I figured that if I offered companies free postings on the site initially they would say "sure thing, no risk to me". They ended up saying " ". I reached out to several companies with the offer of free listings and got silence in return.

After doing some research it turns out I have a "chicken and egg" problem. I need companies to post on my site in order to make money and get the content and backlinks needed for SEO, which will draw in developers; but they will not post unless I have developers actually using my site to find jobs. I figure that getting developers to show up to a site that has job listings is probably easier than getting the companies to post job listings. So for now I am focused on getting the first job listings.

I am not a business marketer, I am a developer. So learning how to get companies to take a risk, even a free one, is not coming easy. Another strategy I tried was reaching out to partner with ZipRecruiter. They have a program where you can post the jobs they have on their site and get money based on click-through. Again, I was met with silence.

At this point, I am starting to wonder if it is illegal to just make the listings myself and have them redirect to companies that have open positions. For example, Blizzard is hiring for a host of positions. When you click to apply it sends you to a form on a specific webpage to apply. If I create a listing on my site for that same job and then have the apply button redirect to their specific webpage, is that illegal?

Right now I am brainstorming ways to get this site off the ground, I have come up with a few that have some merit if you ask me, but for now, just getting one job listing is the goal.
March 31th, 2022
Tags: react, useeffect, usecallback
Published: 2022-03-31 22:20:50

React Hook - **useEffect**

can be used in component life cycle.. (mount, unmount, update...)
After the page is rendering, the useEffect must be run once.
When the dependencies that set in the array, the useEffect is run.

1. useEffect(()=>{})
2. useEffect(()=>{}, [])
3. useEffect(()=>{}, [dependency])

1 -> basic, but not used usually. no dependency, loading anytime
2 -> After the page rendering, the useEffect has be used only once.
3 -> After the page rendering, the useEffect has run one time and run again when the dependency (value in the array) is changed. 


What to do in useEffect

useEffect(() => {
    console.log('mount')
    return () => {
      console.log('unmount)}
, []}

1st param = function 
2nd param = dependency array

return part is clean up part

when mount, 

- set props to state
- request API
- use library
- iteration with setInterval
- work with setTimeOut

when unmount,

clean the registered work(clearInterval, clearTimeout)
clean the library instance

When not setting props that are used in useEffect to dependency array, the function in useEffect cannot point out the latest props.


React Hook - **useCallback**

reuse the already created function

When defining the function like the before, the function is created every time the rendering.

const onRemove = id => {
  setUsers(users.filter(user => user.id !== id));
}; 


const onRemove = **useCallback**(id =>{
    setUsers(users.filter(user => user.id !== id));
}, [users])
A JavaScript Slider in 8 Lines
Tags: javascript, programming, tutorial, css
Published: 2022-03-31 21:52:43

In this post we’ll build a minimal JavaScript slider, with no dependencies. The smallest, actually, without the actual slides’ HTML content: 8 lines of JavaScript.

Building a slider or a text rotator shouldn't use an insane amount of JavaScript and it should leverage modern CSS as much as possible.

**The trick in this tutorial is matching CSS animation timing with the JavaScript `setInterval()` value.**

This is what we’ll build:


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

Let’s start with the HTML code, which, in this case, is one `<div>` element:

```
<div id="slider--text"></div>
```

We will populate this element later using JavaScript.

Styling is optional, but, for the sake of this tutorial, I styled the slider to center align the content, both vertically and horizontally. I have also used a basic animation where I added opacity and a transform property.

```
.fade-in {
    animation: fade 4s infinite;
}
```

**Note how my 4 second animation will match the 4000 milliseconds in the code below.**

Next, we add the JavaScript "sliding" functionality by checking if the element exist, and, if it does, we create an array of strings to slide. Note that you can use HTML.

Next, we create the slider by looping through the slides, and replacing the HTML inside the `#slider--text` element with the slide content. **That is all!**

Next, we call the slider so that it runs immediately, and then we call it every 4 seconds using a `setInterval()` function.

The gist of the JavaScript code is below:

```
const slider = () => {
    document.getElementById("slider--text").innerHTML = slides[i];
    document.getElementById("slider--text").classList.add('fade-in');

    (i < slides.length - 1) ? i++ : i = 0;
};

setInterval(slider, 4000); // Slide every 4 seconds
```

Check out the [JavaScript code for a full breakdown and a slider demo](https://getbutterfly.com/how-to-create-a-minimal-javascript-slider-with-css-transitions/).
Consider these factors before advertising on TikTok
Published: 2022-03-31 21:16:30

TikTok surpassed **1 billion users** in September. The platform is unsaturated and traffic is affordable, which makes it a tempting channel for marketers all over the world. 

It almost seems too good to be true. But there are several factors to take into account. Make sure you read this before you jump into TikTok Ads!

1. Testing a new channel is expensive. Are you willing to divert 20% of your advertising budget towards TikTok? This is the minimum we recommend. After all, the only way to know if the platform works for you is to spend real money on it.

2. Do you have the time? Running ads for a few weeks won’t give you any substantial data. As a rule of thumb, give it at least two months before you make up your mind.

3. Have you tried other short-video channels like Instagram stories or IGTV? If so, have you had any success? TikTok can have cheaper CPAs, cheaper CPMs, and higher quality traffic than Instagram. But transferring the same content from one channel to the other won’t work. You can reuse Instagram content and try your luck, but our advice is to make new, **platform-specific videos**. It’s key to focus on the **content** rather than the video’s look and aesthetic.

If these facts make TikTok ads seem unappealing to you, try an organic strategy first. Upload two videos per week for two months and see how they perform for themselves. This will give you time to get to know the platform and identify the content your audience likes best. 

We are not trying to get you to ditch TikTok Ads, but we know it’s a tricky channel to get a hold of. Simply make sure you have the resources needed to give it a try and remember: **TikTok is not Instagram!**
Haunting Your Way Soon 🔦
Tags: nft, web3, blockchain, beginners
Published: 2022-03-31 20:30:05

ATTENTION GHOSTHUNTERS 🔦

500 **Boos!** NFTs are dropping on **APRIL 18th**! We have some exciting giveaways and announcements leading up to that day. 👻

![Boos Nfts](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5o9eo0gsdphpw3nqn83u.gif)

Hint: You'll also want to follow us on [Instagram](https://instagram.com/codewranglrz/), [Twitter](https://twitter.com/codewranglrz), and [Discord](https://discord.gg/nFAWayJRXZ) because there are some exciting announcements coming your way!

To learn more about the project visit [Codewranglrz](codewranglrz.xyz) and read our latest [blogpost](https://info.codecast.io/blog/introducing-codewranglrz)!
Handle Multiple Exceptions with PHP 7.1
Tags: php, exception, errors, course
Published: 2022-03-31 20:11:11

{% youtube dWNmOjJcVjQ %}


Here is how you can handle easily multiple exceptions thanks to PHP 7.1.

👉  Source code of the example project https://gist.github.com/pH-7/5ba7f83a9e1befc46a68379301eec41e 


### Example

```php
try {
    $person = new Person('Pierre');
    echo $person->greeting('morning'); // can be 'morning', 'afternoon', or 'evening'
} catch(InvalidNameException | InvalidDayMomentException $err) { // Catch multiple exceptions at once
    echo $err->getMessage();
}
```

---
👉 My Udemy course on how to build a real-world PHP 8.1 application from scratch - https://www.udemy.com/course/create-real-world-php-webapp-from-scratch/
Making Peanuts in Tech
Published: 2022-03-31 20:15:50

In 2014, I started my first job, which made me $58K in Boston. Even back then, this was a below-average income in the tech industry. Oh wait, I stumbled into the non-tech industry, sad.

It took me nearly 1 year to realize the income gap, and about 8 months to finish the career switch - being an entry-level software engineer at Amazon.

Since then, I made a few more mistakes. Now, compared with my college friends, they are now making half a million each year. Not too long ago, I was just making peanuts.

Check out this video to see why I was making peanuts even with a Computer Science degree.

YouTube Video: [They Made Half Million($500k+), I Made Peanuts](https://www.youtube.com/watch?v=BchKKoxdeNI&ab_channel=TuwangTech)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wyb53lgdtt6s3g57bi54.jpg)
Have You Heard of Polywork?
Tags: webdev, beginners, programming
Published: 2022-03-31 19:53:37

I recently joined Polywork, a professional networking site that is in beta. It features more ways to discover and connect with others for collaboration, or any other purpose. It has been a good experience so far. I am an early adopter of this, and I wanted to extend an open invitation to you. You may join by using this link:

polywork.com/invite/randwulf-gloom

If you do use it, please let me know what your initial impressions of Polywork are. Thanks 😎
In The Beginning...
Tags: webdev, beginners, blog
Published: 2022-03-31 19:46:37

1. My Journey begins

One of the things I did, while beginning my developer journey, was to read blogs and articles from seasoned developers who are eager to share their knowledge with others. That helped me discover nice websites that are used by developers.

![Picture of blogging](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i7x79vn2ndwfunez9ltf.jpg)

2. Why blog?

Many devs have addressed this question, which provided more insight into their reasons for writing. I believe some of those reasons are learning how to write technical articles better, assist with mental retention of the information, and passing on helpful tips to others who are interested.

![Picture of blog posting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d81so038p1q3og45kdof.jpg)

3. To have or not to have your own website

I learned the value of having one's own website to display blog posts, contact methods, and examples of coding ability. When I saw some portfolios, I was impressed. I also looked at some awesome GitHub profile README's and felt inspired.

4. Hashnode to the rescue!

Many of the helpful people I discovered are on Hashnode. I decided to sign up to make use of the many advantages on this site. After getting that started, I visited Namecheap and got started on my own site. Then I went to the Hashnode dashboard to display the blog on my own website. BTW, I have no affiliation with Hashnode, I'm just a fan.

![Picture of GitHub Octocat](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3erzm0npq8vj3nx0498i.jpg)

5. My Github Profile Readme

So many people have written about the reasons for creating an incredible Github profile readme page. One of those is to display your ability as a developer in a way that nicely demonstrates your skills. Because of these nice articles, I now have a good start on my Github profile readme and personal website.
Conclusion

I intend to continue with these ideas to build a respectable web presence that demonstrates my knowledge, skills, and abilities. Mind you, I'm just beginning. I hope many of you will have a look at my pages and let me know what you think. I know there is plenty of room for improvement.

References:

    freecodecamp.org/news/devblog-launch-your-d..

    vuejsexamples.com/a-website-of-awesome-gith..

    hackernoon.com/how-to-make-a-rockstar-githu..

    daily.dev/blog/adding-the-daily-devcard-to-..

    lo-victoria.com/3-simple-ways-to-make-your-..
Laravel artisan commands error : Failed to parse dotenv file due to an invalid name
Published: 2022-03-31 19:45:58

every time I run php artisan commands I got this error
The environment file is invalid! Failed to parse dotenv file due to an invalid name.
.
to solve this i just replace the APP_NAME which is like below:
**APP_NAME=MY Application**
to
**APP_NAME="MY Application"**

and its solve my issues
.
Thank you
Happy Coding
.
osman forhad
Full-Stack Developer💻 (Mobile App & Web App)
developer.osmanforhad@gmail.com