teleren/devto huggingface dataset:
Daily Challenge #84 - Third Angle of a Triangle
Tags: challenge
Published: 2019-10-07 14:06:18

---
title: Daily Challenge #84 - Third Angle of a Triangle
published: true
series: Daily Challenge
description: Find the third angle of a triangle
tags: challenge
---
You are given two angles of a triangle in degrees.

Write a function to return the third angle. Only positive integers will be tested.

*Sample Tests:*
```thirdAngle(30, 60)
thirdAngle(60, 60)
thirdAngle(43, 78)
thirdAngle(10, 20)```

***
_This challenge comes from user5651159. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
How to disable insecure password warning in Firefox for Selenium?
Tags: selenium, seleniumfirefox
Published: 2019-10-14 15:19:01

---
title: How to disable insecure password warning in Firefox for Selenium?
published: true
date: 2019-10-07 14:04:43 UTC
tags: selenium, selenium-firefox
canonical_url: 
---

If you use Selenium and Firefox version 52 or higher for running the automated tests and your development site does not use SSL, you will get the following warning when entering passwords on your login page `This connection is not secure. Logins entered here could be compromised`

Firefox will also open the URL [https://support.mozilla.org/en-US/kb/insecure-password-warning-firefox?as=u&utm\_source=inproduct](https://support.mozilla.org/en-US/kb/insecure-password-warning-firefox?as=u&utm_source=inproduct) in a new tab which takes the focus away from the page you are testing. It causes currently running Selenium tests to be failed.

The good news is

> you can stop this warning and opening of the new tab by changing the Firefox preference  **`security.insecure_field_warning.contextual.enabled`**  to  **`false`**

### Java Code:

```
// Create a Firefox profile
FirefoxProfile profile = new FirefoxProfile();
//Set the preference to disable insecure password warning
profile.setPreference("security.insecure_field_warning.contextual.enabled", false);
//Pass the profile to the FirefoxDriver
WebDriver driver = new FirefoxDriver(profile);
 
// Start of test code
```

### Python Code:

```
from selenium import webdriver
// Create a Firefox profile
profile = webdriver.FirefoxProfile()
//Set the preference to disable insecure password warning
profile..set_preference("security.insecure_field_warning.contextual.enabled", false);
//Pass the profile to the FirefoxDriver
driver = webdriver.Firefox(firefox_profile=profile);
 
// Start of test code
```
Ajax'd Javascript in dev tools
Tags: ajax, javascript, source, tools
Published: 2019-10-07 14:01:00

---
title: Ajax'd Javascript in dev tools
published: true
description: 
tags: ajax, javascript, source, tools
---
Honestly I'm mostly writing this as a note to my self since I have learnt about and then forgotten this particular trick several times over the last few years.

If you're loading javascript through ajax (quite common when working with ASP.NET MVC) then you can give a hint to the browser which enables it to open it in the dev tools with a specific file name. Just add `//# sourceURL=filename.js` before the closing `</script>` tag.

e.g.

```html
<script>
    $(function() {
        console.log("wibble")
    })

    //# sourceURL=wibble.js
</script>
```

From the browser's dev tools you should now be able to open this file by searching for "wibble.js" (Ctrl+P brings up the search)
How to use the Element Inspector for Mobile Apps
Tags: testing, tutorial, android
Published: 2019-10-07 13:58:47

---
title: How to use the Element Inspector for Mobile Apps
published: true
description: How to use the Element Inspector for Mobile Apps
tags: testing, tutorial, android, devops
cover_image: https://thepracticaldev.s3.amazonaws.com/i/jst2jlz2lirgc7a8w5dq.png
---

###**Introduction**###

It's a known fact: locating elements in Mobile Applications is a hassle.

Appium and other libraries require locators such as ID, Accessibility ID, Name, Class Name, XPath, etc. 

And getting those locators is difficult, because unlike web sites, we can't just Right Click and go into the Chrome Developer Tools.


###**The old way**###

A painful process that involves the following steps:
####1) Get the Page Source.####
####2) Look through the tags and find your element.####
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/jpfnft9vo66snw40r5hm.png)
####3) Extract a locator based on the Appium rules.####
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/uvmmazrj1ujlz8lzlqoh.png)
####4) If no reliable locator is found, write the XPath by hand.####


###**The new way, using the Element Inspector**###

**[Endtest](https://endtest.io)** just added the **Get Element Inspector** action, which extracts the structure of Android and iOS apps and generates a HTML page like **[this](https://s3-us-west-2.amazonaws.com/endtest-tests/BpvbTth1n4G1uwi0KGG6Ty2BlWXjlD/Element_Inspector_1.html)**.

Steps:

####1) Add a Get Element Inspector step.####

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/2cby64ng5ivgg5a7np6u.png)

####2) The execution will generate a HTML with the structure of the app:####
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/tzzqj14pmrj6kj2849sv.png)
 
####3) Click on an element and you'll get all the locators and attributes.####

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/e5cd1usugadn99ivkvhc.png)

It works for Android and iOS apps, native and hybrid.

{% youtube TB0qEnuHu90 %}

You can read more about it in their docs:
[Finding elements in Mobile Applications](https://endtest.io/guides/docs/finding-elements-in-mobile-applications/)
5 Copy and Pasting Tips that Every Developer Should Know
Tags: productivity, vscode, bestpractices, career
Published: 2019-10-07 13:52:26

##Work Smarter, Not Harder.

If I knew about these coding tricks earlier in my career, it would have saved me sooo much time. Here are 5 advanced copy and pasting tips that you can use to work smarter and more efficiently.

*You can follow along with the sample dataset below, or better yet, try it with your own data. FYI— I’m using Mac and Visual Studio Code, but feel free to use other OS and text editors.*

##Sample dataset
{% gist https://gist.github.com/songthamtung/0e428e347fc144127b390768a4902a4d %}

##1. Vertical selection
My objective is to add the `<li>` tag in front of every row. Instead of doing it the old fashion way of copy and pasting multiple times, I do it once with the help of vertical selection.

![Vertical Selection](https://miro.medium.com/max/2400/0*h1JUkFG-BS_Mx01M.gif)<figcaption>Vertical Selection Example</figcaption>

```
hold shift + option + cmd + arrow direction
```

##2. Adding value to the start of every row
Another way to add value to the start of every row is by using regex `(.*)`. This is built into most text editors and can be found in the find feature.

>Regex or regular expression is a sequence of characters that define a search pattern. 

![Regex Start](https://miro.medium.com/max/2400/0*Kyfq_KP1EF8EP-Et.gif)<figcaption>Use regex to add value at the beginning of each row</figcaption>

```
1. Open Find and Replace
2. Enable regex .*
3. Enter ^ in Find
4. Enter value in replace
5. Execute
```

##3. Adding value to the end of every row
What if I want to add the closing </li> tag at the end of every row? To do so, I would also use regex, but with a different search pattern.

![Regex End](https://miro.medium.com/max/2400/0*NPNXV10AgpkVlEvm.gif)<figcaption>Use regex to add value at the end of each row</figcaption>

```
1. Open Find and Replace
2. Enable regex .*
3. Enter $ in Find
4. Enter value in replace
5. Execute
```

##4. Shifting rows without highlighting and dragging
What happens if I want to quickly rearrange my data? Again, I can use the traditional cut and paste or highlighting and dragging with the mouse... but there is a faster way.

![Rearrange Rows](https://miro.medium.com/max/2400/0*sEKbA1l-qpCl1j0k.gif)<figcaption>Quickly rearrange your rows</figcaption>

```
hold option + arrow direction
```

##5. Copy and pasting without copy and pasting
This last tip is one of my favorites. Instead of copy and pasting and entering new lines in between, I can quickly duplicate the values with a simple shortcut key.

![Copy and paste](https://miro.medium.com/max/2400/0*gtwOwiPzMj3HmpcO.gif)<figcaption>Quickly duplicate your lines</figcaption>

```
hold shift + option + arrow direction
```

##Wrapping up
Copy and pasting stuff is great. Regex and advanced keyboard shortcuts takes it to another level. Have another tip for coders to increase productivity? Leave a comment below.

Remember folks: work smarter, not harder.

Thanks for reading! Originally posted on [The Startup](https://medium.com/swlh/5-advanced-copy-and-pasting-tips-ae099d763d6c).
Pacotes de ícones para VS Code – 2019
Tags: dev, tech, icones, icons
Published: 2019-10-08 00:00:50

---
title: Pacotes de ícones para VS Code – 2019
published: true
date: 2019-10-07 13:47:22 UTC
tags: Dev,Tech,icones,icons
canonical_url: https://marquesfernandes.com/2019/10/07/pacotes-de-icones-para-vs-code-2019/
---

Cansado daquele pacote de ícones tedioso e feio do seu VS Code? Confira uma lista com os melhores pacotes para customizar os ícones de arquivos e pastas no seu VS Code!

## [Material Icon Theme](https://marketplace.visualstudio.com/items?itemName=PKief.material-icon-theme)

**Instalações:** +2,5 milhões  
**Estrelas:** 4,9

![Material Icon Theme](https://marquesfernandes.com/wp-content/uploads/2019/10/image.png)

[Material Icon Theme](https://marketplace.visualstudio.com/items?itemName=PKief.material-icon-theme) é o pacote de ícone que eu mais gosto e uso, conta com uma ampla seleção de ícones proprietários além de identificar e customizar diversas pastas padrões, como por exemplo a pasta “src/”.

## [vscode-icons](https://marketplace.visualstudio.com/items?itemName=vscode-icons-team.vscode-icons)

**Instalações:** +3,7 milhões  
**Estrelas:** 4,8

![vscode-icons](https://marquesfernandes.com/wp-content/uploads/2019/10/screenshot.gif)

vscode-icons é o pacote mais baixado, com mais de 3,7 milhões de downloads e 341 estrelas, conta com uma ampla variedade de ícones.

## [VSCode Great Icons](https://marketplace.visualstudio.com/items?itemName=emmanuelbeziat.vscode-great-icons)

**Instalações:** +560 mil  
**Estrelas:** 4,9

![VSCode Great Icons](https://marquesfernandes.com/wp-content/uploads/2019/10/icons-1024x670.jpg)

VSCode Great Icons conta com mais de 100 ícones diferentes, no top 3 pacotes mais baixados é uma boa alternativa para seus ícones!

## [Nomo Dark Icon Theme](https://marketplace.visualstudio.com/items?itemName=be5invis.vscode-icontheme-nomo-dark)

**Instalações:** +117 mil  
**Estrelas:** 4,8

![Nomo Dark Icon Theme](https://marquesfernandes.com/wp-content/uploads/2019/10/screenshot-marketplace.visualstudio.com-2019.10.04-19_14_50.png)

[Nomo Dark Icon Theme](https://marketplace.visualstudio.com/items?itemName=be5invis.vscode-icontheme-nomo-dark) não é tão famoso como os demais, porém seu estilo de ícones agrada muito.

O post [Pacotes de ícones para VS Code – 2019](https://marquesfernandes.com/2019/10/07/pacotes-de-icones-para-vs-code-2019/) apareceu primeiro em [Henrique Marques Fernandes](https://marquesfernandes.com).
The Building an Indie Business Podcast- Product Update Forum Edition
Tags: webdev, podcast, javascript, design
Published: 2019-10-07 13:26:16

In this episode I discuss the forum I am building for Open Podcast and other features I will build in the future.

[Episode Page](https://baib-podcast.com)
[Revenue Research](https://revenueresearch.co/)

https://overcast.fm/+RG5i3J-UA
Dank Mono
Tags: vscode, fonts, dankmono
Published: 2019-10-09 10:55:23

---
title: Dank Mono
published: true
date: 2019-10-07 13:03:09 UTC
tags: vscode, fonts, dankmono
---

[Dank Mono](https://dank.sh)

I switched[^1] my main programming font last week from Fira Code 2 to [Dank Mono](https://dank.sh).

After a couple of days, I have to say I am enjoying it.

1. The italic crossed with script (cursive) is a nice visual change.
2. Supports ligatures which is now a must have for me.
3. There are two types of developers. Those who love change and those who hate change. Neither are right or wrong, but I am in the love change camp. The small visual update makes everything feel more fresh.

The recommended font-size with it is 14. I had been running Fira Code (which I still love) at 24px. For Dank I switched to 20px and bumped the font-weight up to 500 in Visual Studio Code.

[^1]: [Check out](https://howivscode.com/scottwater) if you want to see if I stick with Dank Mono
Same Origin Policy & Cors
Tags: sameoriginpolicycors
Published: 2019-10-07 12:57:17

The backbone of modern internet web security is something called the Same Origin Policy. It refers to the standard in place throughout most of the interwebs that restricts access to a webpage from a secondary page unless the two pages share the same 'origin'. What's an origin you may ask? Well an origin is the combination of domain, host name, and port number, all working in tandem to provide a very specific identification address for where your page lives on the internet

This mechanism bears a particular significance for modern web applications that extensively depend on HTTP cookies[1] to maintain authenticated user sessions, as servers act based on the HTTP cookie information to reveal sensitive information or take state-changing actions. A strict separation between content provided by unrelated sites must be maintained on the client-side to prevent the loss of data confidentiality or integrity.


While waiting on that to load, let's talk about CORS a bit. CORS stands for Cross Origin Resource Sharing. It as implemented a a bit of a work around for Same Origin Policy because sometimes sites actually do want to allow access to their page from outside sources. 

They accomplish this by making allowances to certain pages in their response headers. This can be verified with the use of a get request that will show if a page has permission to access or not.

For Ajax and HTTP request methods that can modify data (usually HTTP methods other than GET, or for POST usage with certain MIME types), the specification mandates that browsers "preflight" the request, soliciting supported methods from the server with an HTTP OPTIONS request method, and then, upon "approval" from the server, sending the actual request with the actual HTTP request method. Servers can also notify clients whether "credentials" (including Cookies and HTTP Authentication data) should be sent with requests

The browser sends the OPTIONS request with an Origin HTTP header to service.example.com containing the domain that served the parent page:

Origin: http://www.example.com
The server at service.example.com may respond with:

An Access-Control-Allow-Origin (ACAO) header in its response indicating which origin sites are allowed. For example:

Access-Control-Allow-Origin: http://www.example.com
Since www.example.com matches the parent page, the browser then performs the cross-origin request.

An Access-Control-Allow-Origin (ACAO) header with a wildcard that allows all domains:

Access-Control-Allow-Origin: *
An error page if the server does not allow a cross-origin request

Hopefully, if you were in the dark about what exactly same origin policy or cors was, this post helped to clarify it somewhat. Happy coding.
VRL Cargo Packers and Movers Rajkot
Tags: packersandmoversrajkot, moversandpackersrajkot
Published: 2019-10-07 12:45:43

VRL Cargo Packers and Movers Rajkot is well-known packers and movers in Rajkot service specializing in residential relocation in and out from all major cities in India. Rajkot is one of the fastest-growing city in India, call thousands of individuals to work here. And that calls for the regular need of a trusted and professional packers movers.
Home relocation is pretty much a part of today’s frequent movement and shifting. However, it may certainly not be as simple as it sounds. Relocation of Home requires an adequate amount of planning and structured layout in order to make it hassle-free and smooth sail. Home shifting involves the relocation of the entire system to a new location in the orderly state.
The process of Home Relocation includes Packing of Individual items, Loading, Moving to a new place, unloading and unpacking if needed. VRL Cargo Packers and Movers Rajkot makes the journey easy, comfortable and speedy.

Address:
VRL Cargo Packers and Movers Rajkot
Office No. 5, Virani Aghat, Dhebar Rd, Rajkot,360001
Call- 9992778833
Visit: https://g.page/vrlcargopackersmovers
Website: http://vrlcargomoverspackers.co.in
Unit Tests Do Find Bugs
Tags: webdev, javascript, unittesting, bugs
Published: 2019-10-07 12:27:32

---
title: Unit Tests Do Find Bugs
published: true
description: This article is my "attempt" to define the benefits of proper levels of testing, from my own personal experience.
tags: WebDev, JavaScript, Unit Testing, Bugs
series: Front-End Testing
cover_image: https://thepracticaldev.s3.amazonaws.com/i/60lq640y4iz1ur5d7tet.png
---

(Sorry, lazily reused the same graphic above.)

This article is my "attempt" to define the benefits of proper levels of testing. I had a larger project in the past that showed clear benefits from developer-level Unit and Integration Testing.

I will update the contents here from time-to-time as I get more concrete numbers.

## Script Parser and Engine

> ~120,000+ LINES-OF-CODE
> 58 BUGS found before reaching production BY TESTING
> 1 BUG found once the code was in production BY USERS

This means ...

> 1 BUG per ~2,034 LINES-OF-CODE

From December 2016 until April 2017, about five months, I wrote the 120,000+ lines of code that became a parser and engine for a "user" scripting language. This language replicated (in JavaScript) one created on a mainframe with almost three decades of fine-tuning and optimization.

While writing this code, I began writing Unit and Integration Tests. The integration tests being written were designed to tests the parts of this system against each other (for example, could I pass in a script to the parser and get an appropriate Active Syntax Tree back). I was not using Test-Driven Development (TDD).

I also kept track of the number of bugs in the original code that did not make it to production ... 58 bugs found

Once the code was ***released*** into production, there were two (2) issues and one (1) bug located by users running scripts against this code. The issues were due to incorrect specifications between what I was actually designing and what was needed.

## Testing Checklist

> ~700 LINES-OF-CODE
> 5 BUGS found before reaching production BY TESTING
> 0 BUGS found once the code was in production BY USERS

This means ...

> 1 BUG per ~140 LINES-OF-CODE

This application was actually the catalyst for this article. I designed an application for developers, designed to reinforce the testing ideals we were trying to propagate to the client's teams.

Proper testing, in this case, allowed me to see a refactor of the logging methodologies that made the code easier to read and understand, as well as simpler to test.

## Conclusions

This article is simply my "attempt" to define the benefits of proper testing levels. Having had a larger project in the past that showed clear benefits from developer-level Unit and Integration Testing, this seemed like a clear direction to go.

I will update the contents here from time-to-time as I get more concrete numbers.
How do AWS CloudFormation, Azure Resource Manager, and GCP Deployment Manager compare?
Tags: discuss, aws, azure, cloud
Published: 2019-10-07 12:16:15

---
title: How do AWS CloudFormation, Azure Resource Manager, and GCP Deployment Manager compare?
published: true
tags: discuss, aws, azure, cloud
---

They are all Infrastructure as Code tools of the respective cloud providers.

I'd love to learn about your personal experience. Missing features, developer experience, error handling, gaps, whatever!
Difference between break and return in ruby
Tags: todayilearned, ruby
Published: 2019-10-07 12:12:26

---
title: Difference between break and return in ruby
published: true
date: 2019-10-07 11:55:18 UTC
tags: til, ruby
canonical_url: https://blog.kudapara.co.zw/difference-between-break-and-return-in-ruby-ck1gcz5ny001i7vs179lebnnm
---

## What did I learn today 🤔
I learned the difference between `break` and `return` keywords in ruby.

## Details please
`return` exits from the entire function.

`break` exits from the innermost loop.

Thus, in a function like so:

```ruby
def testing(target, method)
  (0..100).each do |x|
     (0..200).each do |y|
      puts x*y
      if x*y == target
        break if method == "break"
        return if method == "return"
      end
    end 
  end
end
```

`return` exits from the `testing`  function whilst `return` exits from the `(0..200).each` loop.

## Links

[https://stackoverflow.com/questions/4601631/break-and-return-in-ruby-how-do-you-use-them](https://stackoverflow.com/questions/4601631/break-and-return-in-ruby-how-do-you-use-them)
Best Resources To Start Into Learning Web Development (HTML, CSS, JavaScript, React, NodeJS)
Tags: beginners, javascript, react, tutorial
Published: 2019-10-07 11:08:19

---
title: Best Resources To Start Into Learning Web Development (HTML, CSS, JavaScript, React, NodeJS)
published: true
description: Best Resources To Start Into Learning Web Development (HTML, CSS, JavaScript, React, NodeJS)
tags: beginners, javascript, react, tutorial
---

In my JavaScript workshops I get constantly asked,
which learning resources I can recommend.

Because this is an important & interesting question,
I will give you my opinion on this.


### HTML + CSS:

- Read: [MDN: HTML](https://bit.ly/dev-mdn-html)
- Read: [MDN: CSS](https://bit.ly/dev-mdn-css)
- Read: [Web Design in 4 minutes](https://bit.ly/dev-wd4m)

MDN is a great resource to get into learning.
Sometimes they use a lot of tech speech,
but later on you want to read a lot of documentations,
therefore you want to familiarize yourself with tech speech.


### JAVASCRIPT: Beginner

- Read: [JavaScript in 14 minutes](https://bit.ly/dev-js14m)
- Read: [MDN: JavaScript](https://bit.ly/dev-mdn-js)
- Watch: [Practical JavaScript](https://bit.ly/dev-pjs)
- Watch: [The Modern JavaScript Bootcamp (2019)](https://bit.ly/dev-mjsbc)

I would do all the stuff in exactly that order,
because first you do some small practical stuff (JS in 14min),
then you learn the theory behind it (MDN JS),
then you build a lot of practical stuff (PracticalJS)
and finally you do all over again in a great course (JS Bootcamp).


### JAVASCRIPT: Advanced

- Watch: General: [JavaScript Algorithms and Data Structures Masterclass](https://bit.ly/dev-jsadsmc)
- Read: General: [You don't know JS](https://bit.ly/dev-ydkjs)
- Watch: Frontend: React: [The Beginner's Guide to React](https://bit.ly/dev-bgr)
- Watch: Frontend: React: [The Complete React Developer Course](https://bit.ly/dev-crdc)
- Watch: Backend: NodeJS: [The Complete Node.js Developer Course](https://bit.ly/dev-cndc)

This is my prefered order, but I totally understand that some people don't get motivated by the Algorithms & Data Structures stuff.
To my younger self: Learn the Algorithms & Data Structures first. It will save you a lot of times afterwards.


### WEB DEV: All in one

- Watch: [The Web Developer BootCamp by Colt Steele](https://bit.ly/dev-wdbccs)

If you want to do some comprehensive course and not 10 different ones, I would go with this one.