teleren/devto huggingface dataset:
Go Series: Closure
Tags: go, beginners
Published: 2022-11-15 07:35:13

![Golang Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8tdkgcszo71tdh7eans9.png)

{% replit @achristoph/Closure  %}

A closure is the combination of a function and the lexical environment within which that function was declared.
This environment consists of any local variables that were in-scope at the time the closure was created.
The closure concept exists in many languages, in JS for example , it is heavily used for many cases. In go, closure is commonly used for defer and goroutines - we'll explore more of these topics in upcoming series.   
The function adder returns another function when invoked, the lexical scope includes the sum variable which is accessible by the returned function. Note that in Go, a closure is always an anonymous function.

```go
func adder() func(int) int {
   sum := 0
  // this is a closure, it has access to sum variable
  // each closure has its own sum variable
	return func(x int) int {
		sum += x
		return sum
	}
}

```
every time adder is invoked, it creates a new function with closure.
```go
  addFn := adder()
  fmt.Println(addFn(1)) // initial sum value of 0 is added to 1  
  fmt.Println(addFn(2)) // returns 3, sum variable is maintained by addFn closure
  // calling adder like below will not work as intended as the closure from first line is not being used by the second line, instead, creating a new one
  fmt.Println(adder()(1)) // returns 1
  fmt.Println(adder()(100)) // returns 100
```

Another example of closure below where the closure is assigned to a variable first
```go
func namer() func() string {
	name := "my name"
  // name variable still exists in fn even after namer is finished
	fn := func() string {
		return name
	}
  return fn
}
```

With the fundamental understanding of closure, let's explore defer in the next post - one of the unique things in Go compared to other popular languages
10 tips to reach 5400+ ⭐️ stars on a GitHub with an open source project
Published: 2022-11-15 07:30:58

We are maintaining an open-source React framework for building CRUD apps easily.

<div>
<a href="https://github.com/refinedev/refine">
    <img  src="https://refine.dev/img/diagram.png" alt="refine blog logo" />
</a>
</div>
You can take a look: [https://github.com/refinedev/refine](https://github.com/refinedev/refine)

We’ve reached 5.4K stars on GitHub, but more work still needs to be done! I'll write a detailed article about how we did it in the next months. However, this short post will cover only quick tips. 

I'll dive deep into the sections below in the next articles

#### 1. Post updates regularly - Twitter and Linkedin
#### 2. Engage with your community - We offered 7/24 support on Discord
#### 3. Offer valuable content- Published Content on Devto and Hashnode and refine Blog
#### 4. Be active on other platforms like Reddit and Hackernews
#### 5. Prepare yourself very well for the Product Hunt Launch
#### 6. Keep your project updated
#### 7. Have a clear Roadmap for your project
#### 8. Make it easy to contribute - Encourage contributions from others
#### 9. Be responsive to issues and pull requests
#### 10. Prepare good README and Documentation.

If you have any other tips, feel free to share them in the comments!
How to Create Online Registration Form Template the Best Way?
Tags: onlineregistrationform, registrationformtemplate, createonlineregistrationform
Published: 2022-11-15 07:10:56

In the olden times, the registration process for events and similar things use to be extensive. In modern times, it has been made easy with the help of the best online forms which help in creating registration forms and gathering all sorts of information that you might want to get. It is the best thing because it has made it easier for everyone to register for whatever events or similar things that they might want to do. 

Based on the options that are available on the internet, one can conclude that most of them are very similar and pretty generic. They don’t have any sort of extended customization options based on which you can get the best results according to your need. You need something that can also help you with the management of the information so that you don’t have to worry about storing it all by yourself.

## The Best Alternative to Generic Online Forms

You should know **[why create online registration form template](https://signupforms.com/)** so that you can be aware of the fact that it is going to be the best thing for you. With the help of a service like Signup Forms, you will have the capacity to create the most stellar online forms that you will be able to create and use for anything that you want. It is one of the best online forms that are available out there and they offer a variety of extra services that these generic online forms might not be able to offer you in any way. It is a highly dependable way to create the best registration forms online and get the job done. 

They have got a variety of options available with them that you can use without any hassle. they have got some very premium services as well that you can use at the most budget-friendly prices that are possible. It is going to be a great experience for you based on the fact that these forms have got some pretty great customization and management options that you can use based on your need. You are going to need this because it is going to give you the ease of doing the job which the generic forms might not do for you.
Planning your perks in a way that they are beneficial to employees and employers alike
Tags: employeeproductivity, employemonitoring, ai, cloudnative
Published: 2022-11-15 07:04:44

Do you have an idea that well [planned perks](https://we360.ai/blog/how-employee-productivity-software-can-help-your-business) can be beneficial not only to the employee but to the employer or the company as a whole? Lets elaborate on this one starting with a conversation.

Boss to the HR: What would people prefer – Cash In Hand or Perks?

HR: Cash In Hand

Boss: Then why do we offer perks?

HR: People can't showcase their salary in public

But, they can flaunt the perks openly

Perks have the power to build our Employer Brand
Tea Burn | Know This Before Buying | What User Saying About It? Update 2022
Published: 2022-11-15 06:51:02


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

Tea Burn A flat belly diet one whose calorie content is less than your calorie need on a daily basis Tea Burn If you for you to lose your belly fat, you, must consume lesser calories than you spend every morning ,. Steady, safe Weight Loss should amount to approximately in order to two pounds per 1 week period Tea Burn If you have a lot of weight to lose, your first efforts at Weight Loss might yield more extreme results, an individual don't want extremely quick weight loss to continue.



https://www.outlookindia.com/outlook-spotlight/tea-burn-review-oral-weight-loss-formula-effective-or-waste-of-money-news-237273

https://teaburningredients.tumblr.com/
https://teaburndiet.wordpress.com/
https://tea-burn-benefits.jimdosite.com/
https://teaburndiet.wixsite.com/tea-burn
https://teaburndiet.mystrikingly.com/
https://teaburndiet.zohosites.com/
https://sites.google.com/view/teaburnprice/
https://groups.google.com/g/tea-burn-benefits/c/HcpsO9M_nmI
https://datastudio.google.com/reporting/6fa2b4ce-93f9-4c1f-a318-789d40e96c61/page/HNj7C
https://colab.research.google.com/drive/1TgoWwbiQ4dTuBm8qkxKbWPZmbYSWjDrt
https://teaburn.jigsy.com/
https://teaburndiet.splashthat.com/
https://tea-burn-62.webselfsite.net/
https://tea-burn-98c204.webflow.io/
http://teaburndiet.wikidot.com/
https://teaburn.bravesites.com/
https://teaburn.ukit.me/
https://telescope.ac/tea-burn/teaburn
https://teaburndiet.weebly.com/
Animated Portfolio Website Using HTML CSS and JavaScript
Tags: html, css, javascript
Published: 2022-11-15 06:45:05


Hey guys we are going to learn How to Make an Animated Portfolio website in HTML CSS and also a little bit of JavaScript. Inside the project, you will learn many animations such as displaying images after loading the page.

Then you will learn to display the underline in menus when you will hover the mouse, finally is a very important and also cool affect. When you will load the page you will able to see the text will change after 5 seconds.

So, you will learn step by step to create an Animated website using HTML CSS, and JavaScript. So, hope this tutorial is helpful and beneficial for you. Also, you will learn many new things from the video.

{% embed https://www.youtube.com/watch?v=7srcHXrdIeM
 %}
C++ da Data structuralar va Algoritmlar
Tags: programming, cpp, beginners, tutorial
Published: 2022-11-15 06:45:02

## Data Structura nima? 
DS - bu computer science sohasining eng muhim subjectlaridan biri bo'lib, agar siz kuchli software va dasturlash yaratishni hohlasangiz bu subjectni bilishingiz zarur bo'ladi.

### Tarif:
> Dasturlashda DS bu ma'lumotni foydalanishga qulay usulda yaratish, boshqarish va saqlashdir.

Oddiy qilib aytganda DS - ma'lumotlarni qay tarzda kumpyuterimizga saqlashimizdir.

Data Sftructuralar bu data type(int, char, etc.) lar emas, phyisical entitylar emas, ular shunchaki spesifikatsiyalardir ya'ni biz kompyuterimizdagi ma'lumotlarni oson ishlata olishimiz uchun joriy etgan qoidalar to'plami.

## DS'lar nima uchun kerak?

- har bir ds(data struktura) ma'lumotni maxsus holatda saqlanishi uchun hizmat qiladi.
- har bir maxsus ds faqatgina ma'lum bir muammolar uchun yaratiladi.
- DS judayam ko'p ma'lumotlar bilan imkonini beradi, misol uchun juda katta database(malumotlar bazasi) yoki `hash table`.

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

Lug'atni real-world na'muna qilib oladigan bo'lsak, har bir harf uchun so'zlar ajratib qo'yilgan.


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

Ushbu misolda esa, haritadagi joylashuv X va Y koordinatalari orqali belgilanad va ushbu holatda ma'lumotlar ham X va Y ko'rinishida saqlangan.

## ARRAY

Array bu - har bir elementiga ularning indexlari orqali murojaat qilish mumkin bo'lgan faqat bir hil tipdagi ma'lumotlar to'plami. Array DS'ning sodda bir ko'rinishidir.

### Oddiy C++ array ni ko'rib chiqamiz:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/peo1yp0gqw2iye16sh7k.png)
11 Programming Blogs and Websites to Improve You as a Programmer
Published: 2022-11-15 06:43:31

Hi developers and designers. In today's post I'm going to share 11 of the incredible blogging websites on programming that I believe every developer should be reading from. 

**Disclaimer: I'm not sponsored by any of these resources in this post. They're so good, I can't just keep it to myself but share them so all can benefit**

# 1. [css wizardy](https://csswizardry.com/page2/#section:articles)
Blogs on this website are written by Harry who is an award-winning Consultant Web Performance Engineer, designer, developer, writer, and speaker from the UK. It contains excellent articles on CSS. I'm sure everyone finds something useful according to their needs

# 2. [css tricks](https://css-tricks.com/)
CSS-TRICKS is a must to have website for any beginner to advanced web developers. All the articles in there are top-knotch and provides a great value. If you want to take your web development to a next level then this website is what you need.

# 3. [javascript weekly](https://javascriptweekly.com/)
JavaScipt weejly is the newsletter website where they send you articles and challenges to do on weekly basis.

# 4. [jstips](https://www.jstips.co/)
JS Tips is a collection of useful daily JavaScript tips that will allow you to improve your code writing

# 5. [30 seconds of code](https://www.30secondsofcode.org/)
30 seconds of code provides a wide variety of snippet and article collections for all your development needs. Explore individual language collections or browse through collections about specific topics and programming concepts.

# 6. [patterns dev](https://www.patterns.dev/)
Improve how you architect webapps. Patterns dev is a free book on design patterns and component patterns for building powerful web apps with vanilla JavaScript and React.

# 7. [refactoring guru](https://refactoring.guru/design-patterns/)
Refactoring Guru makes it easy for you to discover everything you need to know about refactoring, design patterns, SOLID principles, and other smart programming topics.

# 8. [alex kondov](https://alexkondov.com/)
This blog website by Alex Kondov is a full of great articles with great tips and best practises. I'm sure that you'll gain knowledge from his blog posts

# 9. [react typescript cheetsheet](https://react-typescript-cheatsheet.netlify.app/)
Cheatsheets for experienced React developers getting started with TypeScript

# 10. [97 Things Every Programmer Should Know](https://97-things-every-x-should-know.gitbooks.io/97-things-every-programmer-should-know/content/en/)
Pearls of wisdom for programmers collected from leading practitioners.

# 11. [a list apart](https://alistapart.com/)
A List Apart explores the design, development, and meaning of web content, with a special focus on web standards and best practices.
UGC NET PREVIOUS YEAR QUESTION PAPERS
Tags: ugc, net, questionpaper
Published: 2022-11-15 06:10:48

The aspirants can immediately get the UGC NET Previous Year Question Papers PDF of 2021, 2020, 2019, and 2018 from this article to help them prepare for the upcoming UGC NET Examination. These UGC NET Previous Year Question Papers must be included in the candidates’ preparation plan for the UGC NET exam.
The previous year’s papers are a crucial component of any competitive exam preparation. Regularly solving the UGC NET Previous Year Questions Paper can help you develop better time management techniques, as well as understanding of your accuracy and the speed at which you can complete a question.

The UGC NET sample questions provide the applicants with tailored advice on the subject areas they should focus on in order to pass the test with ease.

[Download Question Papers](https://www.solvingpapers.com/download-ugc-net-previous-year-question-paper/): https://www.solvingpapers.com/download-ugc-net-previous-year-question-paper/
Python Script to Quickly Delete S3 Buckets
Tags: aws, s3, python
Published: 2022-11-15 05:50:59

I got frustrated having to empty and delete S3 buckets using the AWS Console, so I created a `Python` script to do it for me!

**WARNING: This method bypasses all of the usual safety associated with deleting buckets with the `AWS Console`, so make absolutely sure you want to delete your bucket before running this script.**

```python
# Use the boto3 library to communicate with AWS
import boto3

# Buckets you want to delete, specified by their names
BUCKETS = [
    "bucket-one",
    "bucket-two",
]

s3 = boto3.resource("s3")
for bucket_name in BUCKETS:
    # For each bucket, create a resource object with boto3
    bucket = s3.Bucket(bucket_name)
    # Delete all of the objects in the bucket
    bucket.object_versions.delete()
    
    # Delete the bucket itself!
    bucket.delete()
```
Excel and Sheets. Is it time for a third alternative ?
Tags: excel, webdev, product, discuss
Published: 2022-11-15 05:44:48

My first memories of any number crunching software was Microsoft Excel. On a very slow Windows XP machine, Excel was the only spreadsheet program anybody needed and it was an overkill even then. The sheer number of features available on excel including the formulas and recently released plugins.

Anybody from Hedge Funds to Small Industries used excel to automate a good chunk of their work and proved to be one of the top selling software with the MS Office Suite.

Google Sheets was a more anew introduction with the Google Suite, which comes into adoption with the widespread usage of remote working and multiple people collaborating on similar projects. The fact that it's actually a web app that functions seamlessly shows the amount of work put into action.

Here comes the problem. Isn't it high time there's a complete redesign of our spreadsheet software and provide customers with a more user-friendly and data intense alternative ? There're some very fundamental tasks that could be converted into a user-friendly version in my opinion.

- Basic Data inputs
- Categorizing Data
- Easy access to third party plugins
- Ability to convert tables into diagrams and visual representations

Let's Talk ?
Express IP Blocker
Tags: webdev, node, api
Published: 2022-11-15 05:35:51

# Express IP Blocker

https://www.npmjs.com/package/express-ip-blocker-current
https://github.com/ahmetilhan24/express-ip-blocker/blob/master/README.md

_You can use this package to prevent continuous requests to APIs you write with Express.js within a certain period of time._

## Instalation

_package (yarn or npm)_

```shell
    npm install express-ip-blocker
```

_PeerDependencies_
_Optimum versions_

```shell
    "cookie-parser": "^1.4.6",
    "express": "^4.18.2"
```

## Usage

```js
const express = require("express");
const app = express();
const cookieParser = require("cookie-parser");
const ExpressIPBlocker = require("express-ip-blocker-current");
const expressIPBlocker = new ExpressIPBlocker();
// You have to do this for the package to work
app.use(cookieParser());
// IP Middleware
app.use(expressIPBlocker.checkIP);

app.listen(//port, () => {
  //
});
```

_See demo for example usage._ ./demo/index.js

## Config

_You can apply a config to the package's run settings_

```javascript
{
  limit: number; // default = 10
  secretKey: string; // default = now Date()
  reqBlockMessage: string; // default = Too Many Requests
  expire: number; // default = 1000 * 10 -> 10 second
}
```

_*Coded by ahmetilhan*_
Uncaught TypeError: Cannot read properties of null (reading 'getContext')
Published: 2022-11-15 05:19:22

When i create a project, in console the first thing i find is the error "Uncaught TypeError: Cannot read properties of null (reading 'getContext')".

I only installed dependencies with yarn, nothing more. Does anyone know why this is happening?
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j4n26d5p1tcyr5c9xueu.png)
Count Complete Tree Nodes
Tags: leetcode, python
Published: 2022-11-15 05:19:04

Given the root of a complete binary tree, return the number of the nodes in the tree.

According to Wikipedia, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far left as possible. It can have between 1 and 2h nodes inclusive at the last level h.

Design an algorithm that runs in less than O(n) time complexity.


```py

class Solution(object):
    def countNodes(self, root):
        if not root: 
            return 0
        return self.countNodes(root.left) + self.countNodes(root.right) + 1

```
Strategies for documenting code
Tags: programming, beginners, webdev, javascript
Published: 2022-11-15 05:09:14

Documentation aims at explaining how the code works, and how to use it. 

Let's look at some ways to document your code:

- comments :- put some comments (something is better than nothing), because it would helpful for your future self, and others who are going to work on it.

- providing images, block schemes, diagrams, links and references to cool reference, where it's explained more in details (might be place from where you learned it.)

- **README files** containing all the necessary information about code utilization

- **release notes/changelogs** will help developer to get where the stuff is heading toward what is the recent progress.

## Pros & Cons

Documenting your code is an important skill to have, some need to practice it, and some born with it. 

### Pros

- Saves time, when you next time need to make changes to it.
- helps to refresh your memory
- helps to fix bugs
- allows for version control
- Helps others to go deep into your code, and motivates them to contributes.

### Cons

- takes a lot of time and patience to write good documentation.
- easily becomes outdated, so needs to be updated all the time
- constant feedback is needed to make it genuinely good which is usually hard to get, for small teams.
- Boring!!!
Ruby Code Challenge: Sum of all primes within an array
Tags: ruby, algorithms, math
Published: 2022-11-15 05:09:00

A prime number is a number that is only divisible by itself and 1. Today I'll be walking through a fundamental algorithm problem you may see in coding assessments: Finding all the prime numbers in an array, and generating their sum. 

## Input

```
arr = [2, 5, 10, 12, 7, 2, 11, 4]
```

## Output

```
--> 27
```

## Find a single prime

Before you can find a multitude of primes within an array, we need the capability of determining whether or not a single integer is a prime number.

```
num = 5

def is_prime?(num)
    # Your code here
end
```

First step is to create an array of values we will be dividing our integer by. Since we don't need to check 1 and the integer we're testing, we can leave those out of our range.

```
def is_prime?(num)
    (2...num).to_a
end

--> [2, 3, 4]

```

We've created an array of values from 2 to the number we are testing, now we need to select the values that DO divide into our integer in question.

```
def is_prime?(num)
    (2...num).to_a.select{ |divisor| num % divisor === 0 }
end

--> []
```

If our integer truly is a prime number, our return should be an empty array. If it isn't prime, it will be filled with a bunch of values that divide into the non-prime integer. Lastly, all we have to do is evaluate presence of values inside the array to determine whether or not we have a prime number.

```
def is_prime?(num)
    (2...num).to_a.select{ |divisor| num % divisor === 0 }.length === 0 ? num : false
end

--> true
```

However, since this is only the first step, we will need the actual number instead of just a boolean telling us it's true. If the method we've written evaluates to true (meaning it's a prime number), we'll need that value for later.

## Find multiple primes

Create your method:

```
def find_and_sum_primes(arr)
    # Your code here
end
```

This process is very similar to the previous one, but the method we've already written is going to do all the work for us. First, create an empty array inside the method. This will soon house all the prime values in the array being passed as an argument. Then iterate through the input array using select:

```
def find_and_sum_primes(arr)
    primes = []
    arr.select{ |num| # find if num is prime }
end
```

Thankfully, we can just call the method that we've already written to determine if the specific value being selected is in fact prime. Once we have a prime number, push it to our primes array and sum the values

```
def find_and_sum_primes(arr)
    primes = []
    arr.select{ |num| 
        if (is_prime?(num))
            primes << num
        end
    }
    primes.sum
end

--> 27
```

Thank you for reading!