teleren/devto huggingface dataset:
Naming conventions for models and methods grammar wise in Ruby/RoR
Tags: beginners, codequality, ruby, codenewbie
Published: 2021-03-06 15:02:16

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0bdl434fk4hiypfaaa5u.jpg)<figcaption>Designed by rawpixel.com / Freepik</figcaption>

How much do we pay attention to the names of models and methods? If you are a native English speaker, it might have been easy for you to get a sense of it. To be honest with you, it wasn't too easy for me till I understood there are some conventions, as English is my second language. In this article, I will introduce those conventions that apply to Ruby and Rails.

***
###Model names should be noun###
```ruby
# Bad
class Pay
end

# Good
class Payment
end
```
This is because if we assign instances to a variable, the name of the variable will be weird.
```ruby
pay = Pay.new
pays = Pay.all # pays??????
```
If there are more than two words for the model name, use adjective + noun or noun + noun.
```ruby
# Bad
class AttachFile
# This is confusing because it looks like a method name.
end

# Good
class AttachedFile
end
```

```ruby
# Good
class UserSegment
end
```

***
###A method which executes something should be verb or verb + noun###
```ruby
# Change user's status to "active"

# Bad
user.active

# Good
user.activate
```

```ruby
# Send an email to the user

# Bad
user.email

# Good
user.send_email
```
***

###Be careful using uncountable nouns in Rails###
In Rails, there is a convention for using singular/plural forms when you define something like routes and models. Some uncountable nouns like "information" are accepted, but you should be really careful when using uncountable nouns since it can cause not just confusion but errors.

If you are not sure whether the word you want to use is uncountable or not, or if you don't know what its plural form is, there is a very non-native friendly method in Rails. `.pluralize` returns the plural form of the given string.

```ruby
# console

"person".pluralize
 => "people"
"sheep".pluralize
 => "sheep"
"octopus".pluralize
 => "octopi" # Did you know this?!
"the blue mailman".pluralize
 => "the blue mailmen"
'CamelOctopus'.pluralize
 => "CamelOctopi"

# You can set the optional parameter for the count
"apple".pluralize(1)
 => "apple" 
"apple".pluralize(2)
 => "apples" 
```
***
Besides those conventions, it is always a good idea to get someone to review your code. It helps you get a better sense of naming models and methods.
Bing URL Submission API using Laravel / PHP
Tags: bing, php, laravel, seo
Published: 2021-03-06 18:04:14

---
title: Bing URL Submission API using Laravel / PHP
published: true
date: 2021-03-06 14:53:25 UTC
tags: bing,php,laravel,seo
canonical_url: https://adithya.dev/setting-up-bing-submission-url-using-php/
---

If you're finding this post, you're probably frustrated with how poor Bing's [documentation](https://www.bing.com/webmasters/help/url-submission-62f2860b) for their Submission API is. Google's [Indexing API](https://developers.google.com/search/apis/indexing-api/v3/quickstart)on the other hand is quite good. Both of these Indexing APIs help you inform search engines about new or updated content on your website.

- You will need an API key for Webmasters so go to **Settings** -> **API access** -> **API Key** - copy this and keep it handy  

![](https://adithya.dev/content/images/2021/03/image.png)

- Grab the endpoint for the Submission API from [here](https://www.bing.com/webmasters/url-submission-api#APIs) - At this point of writing, it's set to accept a POST request for the following endpoint with the data object

```

POST /webmaster/api.svc/json/SubmitUrlbatch?​apikey=sampleapikeyEDECC1EA4AE341CC8B6 HTTP/1.1​
Content-Type: application/json; charset=utf-8​
Host: ssl.bing.com​

{
"siteUrl":"http://yoursite.com",​
"urlList":[
	"http://yoursite.com/url1",
	"http://yoursite.com/url2",
	"http://yoursite.com/url3"
	]
}

```

- With Laravel, if you're using the HTTP client - it's as simple as this

```
$http = \Http::post("https://www.bing.com/webmaster/api.svc/json/SubmitUrlbatch?apikey=" . $apiKey, 
[   
	"siteUrl" => $siteUrl,    
	"urlList" => $urlList
]
);

echo $http->status(); //to make sure it's all ok
echo $http->body(); //to check the body of response
```


-  **$apiKey** - that you copied earlier. Ideally from a config file or your .env file   
 - **$siteUrl** refers to the main domain that you got the API key for - you can usually see this on the top left of the Bing  
 - **$urlList** is a simple array containing the list of URLs you want to submit (since we're submitting URL's in batch, this makes it much easier)

- With Guzzle, it's pretty similar too

```
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://www.bing.com/webmaster/api.svc/json/SubmitUrlbatch?apikey=" . $apiKey', [
    'form_params' => [
        "siteUrl" => $siteUrl,    
	"urlList" => $urlList
    ]
]);
```

Things should go ok unless you're like me and face a simple, funny (weird) message like this

```
"{"ErrorCode":14,"Message":"ERROR!!! NotAuthorized"}"
```

It just indicates that $siteUrl does not match the proper URL in Bing, change it and you should be good to go.
Day 68 Of 100DaysOfCode: About Data Science
Tags: 100daysofcode, womenintech, codenewbie, python
Published: 2021-03-06 14:44:53

This is my 68th day of #100daysofcode and #python learning. Today also continue to learned from DataCamp about data science. Some time I also completed some assignment of regular expression in python from Datacamp, completed some assignment of importing different type of data.

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Day 68 Of <a href="https://twitter.com/hashtag/100DaysOfCode?src=hash&amp;ref_src=twsrc%5Etfw">#100DaysOfCode</a> and <a href="https://twitter.com/hashtag/Python?src=hash&amp;ref_src=twsrc%5Etfw">#Python</a> <br>Data Science From [DataCamp](<a href="https://t.co/JM7Vp1V7RC">https://t.co/JM7Vp1V7RC</a>)<a href="https://twitter.com/hashtag/Womenwhocode?src=hash&amp;ref_src=twsrc%5Etfw">#Womenwhocode</a> <a href="https://twitter.com/hashtag/100daysofcode?src=hash&amp;ref_src=twsrc%5Etfw">#100daysofcode</a> <a href="https://twitter.com/hashtag/womenintech?src=hash&amp;ref_src=twsrc%5Etfw">#womenintech</a> <a href="https://twitter.com/hashtag/CodeNewbies?src=hash&amp;ref_src=twsrc%5Etfw">#CodeNewbies</a> <a href="https://twitter.com/hashtag/beginner?src=hash&amp;ref_src=twsrc%5Etfw">#beginner</a> <a href="https://twitter.com/hashtag/DEVCommunity?src=hash&amp;ref_src=twsrc%5Etfw">#DEVCommunity</a> <a href="https://t.co/vzAFaISKwD">pic.twitter.com/vzAFaISKwD</a></p>&mdash; Durga Pokharel (@mathdurga) <a href="https://twitter.com/mathdurga/status/1368208907806511105?ref_src=twsrc%5Etfw">March 6, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Kaget ya membaca judul ini?
Published: 2021-03-06 14:38:53

Note: This article is written in Indonesian Language

Salam kenal, saya Reynald Prabha Nova

Halo semuanya, saya kok punya firasat banyak dev Indonesia disini, jadi saya menyapa untuk coba mengumpulkan disini

Wondering... Demografi dev Indonesia di platform dev.to ini kebanyakan dari background apa?

Jadi saya ada poin - poin tanya sebagai berikut...

1. Yang kalian jalani, kalian coding di field apa?
2. Dan apa sih tool yang kallan pakai sehari - hari yang mencerminkan anda?
3. Kalian bekerja di bidang teknologi atau hanya hobbyist?

Untuk jawaban saya sendiri

1. Saya rutin coding di field mobile apps, buat aplikasi menggunakan React-Native
2. React-Native tentu saja, tapi sekarang saat ini juga senang main - main (ReactJS + ExpressJS) / NextJS, PostgreSQL, Full-Stack Wannabe
3. Iya, saya sehari - hari sebagai programmer React-Native di salah satu perusahaan jasa aplikasi

So feel free untuk komen ya ditunggu, thanks, salam kenal lagi
My javascript / tech / web development newsletter for 2021-03-06 is out!
Tags: javascript, tech, webdev, discuss
Published: 2021-03-06 14:03:03

---
title: My javascript / tech / web development newsletter for 2021-03-06 is out!
published: true
description: A roundup of all the best javascript, tech and web development links posted to my linkblog in the past week
tags: javascript, tech, webdev, discuss
---
In this week’s edition:

NFTs, NFTs, NFTs, SuperTwitter, Rapers, VIM, Jobs Clubhouse, MarsCopter, Curators, Tracking Pixels, GDPR Cookies, VR, Spotify, AB Testing, Figma, Soundcloud, TimeCrystals, MoonTrip, Brave, AWS, GCP...

https://markjgsmith.substack.com/p/mark-smiths-newsletter-06-03-2021

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
Google Keep Clone with Django and Vanilla JavaScript
Tags: showdev, django, javascript, webdev
Published: 2021-03-06 13:23:05

| Theme / View | Light Theme | Dark Theme |
| --- | ---- | ---- |
| Grid | ![Google Keeps Clone demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3j5lq2l34jsaak9w7z8u.png) | ![Google Keeps Clone demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vxmtcgu17lepvvwjwfjp.png) |
| List | ![Google Keeps Clone demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nkj69ldlzdzfgk81f9fd.png) | ![Google Keeps Clone demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zx64ygtuanflsa6gmw3.png) |

Try it online [here](https://google-keeps-clone.herokuapp.com/)!

[Google Keep Clone](https://google-keeps-clone.herokuapp.com/) is an easy-to-use open-source application built using Django and Vanilla JavaSCript technologies and distributed under the [MIT license](https://github.com/kimlimjustin/google-keep-clone/blob/master/LICENSE).

{% github kimlimjustin/google-keep-clone %}

GitHub link: https://github.com/kimlimjustin/google-keep-clone
Try it online: https://google-keeps-clone.herokuapp.com/

### If you like this project, be sure to drop a star on GitHub 🌟!
## Happy coding!

You might also like these articles:
{% post https://dev.to/kimlimjustin/google-forms-clone-with-django-and-vanilla-javascript-7ha %}{% post https://dev.to/kimlimjustin/abstractmark-the-modern-markdown-language-2ch1 %}{% post https://dev.to/kimlimjustin/whatsapp-clone-with-mern-stack-mongodb-express-react-node-12pd %}
Daily Developer Jokes - Saturday, Mar 6, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-03-06 13:00:25

---
title: "Daily Developer Jokes - Saturday, Mar 6, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Saturday%2C%20Mar%206%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12594a73e61.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*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 document store go out of business?

___A:___ It had NoSQL.
 -->
Puppeteer Vs Proxies API
Published: 2021-03-06 12:54:01

The world of web scraping is varied and complex and Proxies API sits at one of the most crucial junctions. Allowing web scrapers/crawlers to bypass IP blocks by using a single API endpoint to access our 20 million-plus high-speed proxies on rotation.

One of the questions we get frequently is how we are different from services like OctoParse or Diffbot. Many times it is like comparing Apples and Oranges but when we send this comparison table to our customer's developer team, their CXO, their marketing or SEO team, they typically get it quite easily if we are a suitable service or not.

So here is how we are different from Puppeteer.

Puppeteer lives up to its name and comes closest to full-scale browser automation. It can do more or less everything that a human can do.

It can take screenshots, render javascript, submit forms, simulate keyboard input.

This example takes a screenshot of the Ycombinator home page in very few lines of code.
DAW + Audio Engine Dev Update (#6)
Tags: music, audioprocessing, daw, ava
Published: 2021-03-06 12:35:35

---
title: DAW + Audio Engine Dev Update (#6)
published: true
description: Update #6
tags: music, audioprocessing, daw, ava
//cover_image: https://direct_url_to_image.jpg
series: Funktional Projects Updates
---
Hello! The [previous update](https://dev.to/amuuu/open-source-daw-audio-engine-update-5-2991) was around 3 weeks ago. I haven't been that productive and didn't did as much as I was looking forward to since then, but it's fine. Maybe I'll write about that separately.

**About Ava,** the most important thing that I did was refactoring the whole code base to process per sample rather than processing per full buffers. This helped me fix the issue of playing with virtual instrument parameters! I thought about going with this solution from the beginning but I thought it'd be more complicated so I didn't do it, but later I realized it's the common way.

Now, the sine generator instrument's frequency can correctly change too. Delay still needs to be fixed. I also fixed a couple of bugs and segmentation faults that didn't necessarily occur every time, most of them were because of the way I initialized pointers.

I used to code in C more than C++ and I was used to the C language way of initializing and working with pointers and this used to cause a lot of problems. For example, in class object pointers, instances, going with `malloc` (and not `new`) will cause random segmentation faults and it won't let you use for example polymorphism properly. That's totally reasonable because in this case you'll just reserve a part of memory; you won't create a proper object. Overall, I'm starting to get the grip of C++'s way of object oriented.

It's obvious that there are parts of the code that can be pretty more optimized once they turn into pointers rather than normal variables. I'll slowly refactor them one by one.

Another issue is the documentation which I don't have any plans for now but I should figure something out soon!

The next important tasks are:
- Fixing the delay
- Writing a real-time callback function
- Writing a real-time demo program

Check out Ava's repository from [here](https://github.com/funktional-stdo/ava).
How do closures make private variables possible in JavaScript?
Tags: javascript, webdev
Published: 2021-03-06 12:22:40

Being able to implement private variables and methods is very helpful for restricting access to code. By making a variable private it limits the amount of code that can mutate it. There are several ways to implement private variables and methods in JavaScript. One of such ways is by using closures.

## What is a closure?
A closure is the combination of a function bundled with its surrounding state. This means that we can access the scope in which the function is defined, from inside that function. Let's look at a simple example:

![An example of a closure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kn1vxndikkpu2693yjrl.png)

Here we have an outer function `add` and an inner function `addFive`. Assigning `add` to a variable will return the inner function `addFive`.

![Executing closure example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/frbd0oxzute8ypksnz6c.png)

Invoking the variable and passing a number will execute `addFive`. At first, it seems accessing `x` should not be possible since `x` belongs to the scope of the outer function which has already finished executing. But, because the function `addFive` forms a closure, it also has access to the environment or scope in which it was declared (also known as the lexical environment). 

If a function forms a closure, it can access variables and functions declared in the parent/outer function even after that parent/outer function finishes executing. This principle allows us to implement private variables.

## Implementing private variables
In JavaScript, private variables are not natively available. But knowing how closures work, we can emulate them.

![Implementing private variables](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kr2816q80zh2c9mrxsg1.png)

This example applies the concept we looked at in the previous section. An IIFE(Immediately Invoked Function Expression) is assigned to the constant `Door`. The IIFE executes immediately and returns an object with two methods. This returned object has a function and a variable in its lexical environment.

The IIFE finishes executing, so the variable and function are both inaccessible from the outside. Only the two methods inside the returned object can access them because they form closures.
A Beginner’s Guide To Data Science
Tags: datascience, database, career
Published: 2021-03-06 12:15:51

**What is Data Science?**
Data science is an interdisciplinary field that uses scientific methods, processes, algorithms and systems to discover hidden patterns from the raw data.

**Why Data Science?**
->Traditionally, the data that we had was mostly structured and small in size, which could be analyzed by using simple BI tools. Unlike data in the traditional systems which was mostly structured, today most of the data is unstructured or semi-structured.

Let’s have a look at the data trends in the image given below:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crdarjy188ja0n0xu5dr.png)

This data is generated from different sources like financial logs, text files, multimedia forms, sensors, and instruments. Simple BI tools are not capable of processing this huge volume and variety of data. This is why we need more complex and advanced analytical tools and algorithms for processing, analyzing and drawing meaningful insights out of it.

Let’s have a look at the below to see all the domains where Data Science is creating its notion.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ibcx0ha4snl61fxnyi4h.png)

**Lifecycle of Data Science**
Here is an overview of the main phases of the Data Science Lifecycle:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tk52trzniu9rlb9k878j.png)

**Different job roles data science offers are:**
1. Data Scientist
2. Data Analyst
3. Data Engineer
4. Business Intelligence Developer and many more.

**Data Science Skills**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8iwcmudls6r3nxcjzkty.png)
Managing Coding and College Studies
Tags: codenewbie, java, security
Published: 2021-03-06 12:11:40

Tier 3 First Sem subjects are so boring and they have no relation with Coding and stuff and These subject don't need so much of attention like we can Give that time to Coding and learning new technologies.
 As of my experience, I didn't studied for whole semester and I just started studying Subjects like Mechanical, electrical and electronics only 15 days before exam and scored a good marks. 

You can't be a topper in 15 days but yes u can get a good marks and rest of time we can focus on different skills.
Why my (many!!) contributions were not showing on GitHub 💀
Tags: git, github, todayilearned
Published: 2021-03-06 11:58:25

## Issue
I spend a lot of spare time on side projects and have noticed for a while now that none of my contributions have been showing on GitHub. I just left it and didn't look into it. 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w7zan7zg9hdio9shf5ba.png)

It's really bugged me cause it looks as if I've done no/barely work in some time but in fact I actually have!! 😢

## Fix

`cd` into your repo and check the email git uses i.e. `git config user.email`. My work email showed up as one of my side projects is for work and I've been using work's laptop. I changed the email used to match my GiHub account `git config user.email hello@lorna.dev`. 

Fair to say I'm mega annoyed but glad it's sorted. ✨
C# tutorial for beginners | 2 | Write your first C# program
Tags: csharp, dotnet, programming, tutorial
Published: 2021-03-06 11:43:58

In this C# tutorial series you will learn how to get started programming with C#. You will write your own programs as well as make your own web site.
I can make you successful so you can be a programmer as well.

I've just uploaded the second episode. In this episode you will learn fundamentals of programming as well as basics of how to work with Visual Studio. If you will follow the steps from this video, at the end you will write your first program and you will know how to find, copy and run it.

Please check it out and subscribe to my channel to be notified when my new videos will be released.

Thank you in advance.

Link to video: [https://youtu.be/KTfilr_pnk0](https://youtu.be/KTfilr_pnk0)

Link to my personal blog: [https://www.anmalkov.com](https://www.anmalkov.com)

Link to my playlist: [C# tutorial - Learn C# FAST](https://www.youtube.com/playlist?list=PLDoQ6gLAki7chhisGpuyaVzxOj5Hut3Vb)
useEffect() ReactJS long story short
Published: 2021-03-06 11:42:07

useEffect() allows us to fetch requests, manipulate DOM, using timer function etc.

```javascript
useEffect(() => {
   .......// logic
},[dependencies])

```
useEffect() hook accepts two arguments . 
  1) callback function
  2) dependencies
callback contains side-effect logic. 
put all your side effect logic into the callback function, then use the dependencies when you want to side effect to run.

reference: https://dmitripavlutin.com/react-useeffect-explanation/