teleren/devto huggingface dataset:
Pass the Test with Array.prototype.every()
Tags: javascript, programming, arrays
Published: 2020-10-23 22:27:44

I learned so much this week during my ongoing quest to become a JavaScript ninja. While attempting to solve an algorithm problem I came across the .every() method, which I found to be especially useful. What does the .every() method do? I'm so glad you asked. The .every() method allows you to check and see if every element in an array passes a test. If all the elements pass the test it returns true, and false if they don't.

For example, the following code checks to see if all of the elements in the array are strings. 
```
let arr = ["1", "2", "3"];

const checkString = (arr) => {
    return arr.every((item) => {
       if(typeof(item) === 'string') {
          return true;
    }
  });
  return false
}
console.log(checkString(arr))
// logs true to the console
```
Since all of the elements inside of our array are strings, the function returns true.

If we wanted to check and see if the array contained at least one string we could use the .some() method.
```
let arr = ["1", 2, 3];

const checkString = (arr) => {
    return arr.some((item) => {
       if(typeof(item) === 'string') {
          return true;
    }
  });
  return false
}
console.log(checkString(arr))
// logs true to the console
```
And there you have it, two useful array methods for the price of one blog post. I hope you found this useful, and, as always, happy coding!
Daily Dev Tip - Open VSCode in the existing window
Tags: vscode, webdev, devtip
Published: 2020-10-23 22:26:03

I have been wondering if vscode supports it in the cli and found out that it is. You can just use the `-r --reuse-window` flag.

To open the current folder in existing vscode: 
```bash
code -r .
```

or any other folder:
```bash
code -r any/path
```


**Reference**:
```
code --help
Visual Studio Code 1.50.1

Usage: code [options][paths...]

To read from stdin, append '-' (e.g. 'ps aux | grep code | code -')

Options
  -d --diff <file> <file>           Compare two files with each other.
  -a --add <folder>                 Add folder(s) to the last active window.
  -g --goto <file:line[:character]> Open a file at the path on the specified line and character position.
  -n --new-window                   Force to open a new window.
  -r --reuse-window                 Force to open a file or folder in an already opened window.
  --folder-uri <uri>                Opens a window with given folder uri(s)
  --file-uri <uri>                  Opens a window with given file uri(s)
  -w --wait                         Wait for the files to be closed before returning.
  --locale <locale>                 The locale to use (e.g. en-US or zh-TW).
  --user-data-dir <dir>             Specifies the directory that user data is kept in. Can be used to open multiple distinct
                                    instances of Code.
  -h --help                         Print usage.
```
OSD-Lab5
Published: 2020-10-23 22:11:26

This week I was tasked with refactoring some code, committing it, then rebasing and squashing.

Obviously, I did this to my ever-upgrading linkcheck program where you can find at: https://github.com/MLJBrackett/link-check

In general this lab was pretty easy for me and I had no issues, reason being is I tried very hard when I first created the program to keep the code very clean and small so that maintainability would be easy in the future. But as always, we miss a couple of things here and there. For instance, in this Lab I removed some global variables, removed unused variables and removed a string concatenation between my output strings. While the string concatenation was not needed and my code worked fine with it, it seemed like this was a much better way to implement the change and give a layer of separation between me changing the colour of the output and printing the string afterwards.

You can find my rebased and squashed commit here: https://github.com/MLJBrackett/link-check/commit/bee1842b6de4228ad85b2b32b64292520acde8d1

It was a funny lab because I literally just was researching about rebasing and squashing for my lab 4. You can find more about my experience researching about it at: https://dev.to/mljbrackett/osd-lab4-35l0
How to make a GraphQL Query (or Mutation!) in PHP with Guzzle
Tags: graphql, php
Published: 2020-10-21 22:43:58

---
title: How to make a GraphQL Query (or Mutation!) in PHP with Guzzle
published: true
description: A quick, 3-step, guide to 
tags: graphql, PHP
//cover_image: https://direct_url_to_image.jpg
---

### 1: Define a Query
First, we're going to start off with creating a query. This will be a simple query that will ask for the "name" field for our site.

```php
$query = 'query { site { name } }';
```

Now, this works, but it gets awkward and inconvenient to have to keep our whole query on one line. To fix this, we can use a [Heredoc](https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc) which will allow us to break our query into multiple lines.

```php
$query = <<<GQL
  query {
    site {
      name
    }
  }
GQL;
```

**Note: Make sure the ending `GQL;` statement is not indented at all as that breaks Heredoc syntax.**


### 2: Make the HTTP request

```php
$graphqlEndpoint = 'https://example.com/graphql-api';
$client = new \GuzzleHttp\Client();

$response = $client->request('POST', $graphqlEndpoint, [
  'headers' => [
    // include any auth tokens here
  ],
  'json' => [
    'query' => $query
  ]
]);
```

This is a pretty standard request, but there are two notable things:
1. We're making a POST request. All (properly configured) GraphQL endpoints will only accept a POST request.
2. We're using `json` not `body`.
3. We're not doing any authentication, but you probably will. This will often either be a token you can add as a header, or it will be basic HTTP authentication that you can pass as a top-level option to Guzzle ([see docs](https://docs.guzzlephp.org/en/stable/request-options.html#auth)).

### 3: Retrieve the response
```
$json = $response->getBody()->getContents();
$body = json_decode($json);
$data = $body->data;
```

### 4: Put it all together
```php
$query = <<<GQL
  query {
    site {
      name
    }
  }
GQL;
$graphqlEndpoint = 'https://example.com/graphql-api';
$client = new \GuzzleHttp\Client();

$response = $client->request('POST', $graphqlEndpoint, [
  'headers' => [
    'Content-Type' => 'application/json',
    // include any auth tokens here
  ],
  'json' => [
    'query' => $query
  ]
]);

$json = $response->getBody()->getContents();
$body = json_decode($json);
$data = $body->data;
```
feel like updating my JavaScript skils.
Tags: 100daysofcode, javascript, react, codenewbie
Published: 2020-10-23 21:41:45

    
feel like updating my JavaScript skils. to some other thing like ES6 honestly i'm enjoying it imagine writing code like this isn't that nice? 


const a = 1;
    const object = {
        a,
        b:4,
    };
    const copy = {...object, c:5, d:6};
    console.log(copy);
Day 241: Stay Up
Tags: hiphop, code, coding, lifelongdev
Published: 2020-10-23 21:36:23

_liner notes_:
- Professional : Wow this week flew by!!! Where did the time go? Happy it's Friday, but I never get everything done that I wanted. I was able to finally get a draft done for my next blog post and another demo done for it. Thing is that a demo I created that worked last week for the post, stopped working. It's using the latest version of the JavaScript framework that's been changing. [Edit: Thinking about that it was working last week but not now and there has been a bunch of releases. I rolled the version of the framework back, and it works again!]

- Personal : Stayed up late to work on the blog post and then got up early to finish it up. So I'm pretty tired.

![A ring of waterfalls in the jungle of Sewu Waterfall, Indonesia](https://dev-to-uploads.s3.amazonaws.com/i/34ne1tur1qj76v1v4o8f.png)

Going to finish putting together tomorrow's radio show and maybe call it a night early. It's raining and my futon is calling me. Maybe I'll stay up and work on my side project. Decisions. haha.

Have a great night and weekend!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube d1968JCaO04 %}
42% the Size of HTML SCSS with ZIM...
Tags: zim, zimjs, compare, amazing
Published: 2020-10-23 21:29:20

Once again, we saw some HTML and CSS and thought... yikes!  That could be done in less lines of code!  Here is the original CodePen pen (thanks to the original poster and their clever HTML SCSS):

https://codepen.io/enbee81/pen/LBMKqV 

and here is the ZIM CodePen pen:

https://codepen.io/zimjs/pen/xxORooW

The ZIM code looks like this:

```javascript
// usually users can interact with a Blob
const mask = new Blob({interactive:false})
    .sca(2.5)
    .alp(1)
    .center();
asset("headshot_800.jpg").center().setMask(mask);
// a Blob has a set of control points we will wiggle
loop(mask.pointControls, point=>{
    point
        // prop, start, min, max, timeMin, timeMax
        .wiggle("x",point.x,10,40,4,8)
        .wiggle("y",point.y,10,40,4,8)
        .wiggle("scale",1,.1,.5,4,8);
});
// a manually changed Blob needs updating
Ticker.add(()=>{mask.update();});    
new Circle(355, null, grey, 1, true).center();
new Rectangle(500, 500, null, grey, 1, null, true).center();
```

---

If you have not checked out the Canvas recently - you simply must!  Here is the [ZIM&nbsp;Dev&nbsp;Site](https://dev.zimjs.com) and some [In-depth&nbsp;Guides](https://drabstract.medium.com/) by Dr&nbsp;Abstract including [Your Guide to Coding Creativity on the Canvas](https://drabstract.medium.com/your-guide-to-coding-creativity-on-the-canvas-ada0996298f6).
You DO Know Hex...
Tags: beginners, hexadecimal, hex
Published: 2020-10-23 21:15:59

---
title: You DO Know Hex...
published: true
description: You DO know hex. You just don't know it yet.
tags: beginner, beginners, hexadecimal, hex
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/92i8xssj4urx84tgsxum.png
---

...you just don't know it yet. Allow me to explain.

Back in elementary school, teachers taught us about the *ones*, *tens*, *hundredths*, ... columns. So the number 894 has 8 in the hundredths column, 9 in the tens column, and 4 in the ones column.

More specifically...

```
894 = (8 * 100) + (9 * 10) + (4 * 1)
```

Do you see a pattern with the ones, tens, and hundredths columns? They are all powers of ten: 10<sup>0</sup>, 10<sup>1</sup>, and 10<sup>2</sup>. This is the numbering system we learned in school: *base 10*. The valid numbers in a column are 0 - 9. That makes sense, because we can only have a single digit in a column.

Now in the hexadecimal number system, the base is 16. So the first three columns are the ones, sixteens, and two hundred fifty-sixths columns. In powers of sixteen, they are: 16<sup>0</sup>, 16<sup>1</sup>, and 16<sup>2</sup>. So the number 894 in hexadecimal is:

894<sub>16</sub> = (8 * 256) + (9 * 16) + (4 * 1) = 2196<sub>10</sub>

Note that the subscript indicates the base. 894 is the hexadecimal number. 2196 is the base 10 equivalent. You can also represent hexadecimal numbers like this: 0x894. For the 2196 base 10 number, we typically omit the 10 subscript since it is assumed.

The hexadecimal story continues a bit more. If base 10 uses the numbers 0 - 9, then what does base 16 use? Base 16 must have 16 possible digits. Its range of digits start with the same digits 0 - 9. The remaining six digits are: A, B, C, D, E, and F. The letters stand for 10 - 15 respectively. So, counting in hexadecimal is like this:

```
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
```

I guess it would be too confusing in elementary school to combine numbers and letters in math. But it would've been fun trying.

For a final example, here is the conversion of hexadecimal F0A to base 10:

<pre>
F0A<sub>16</sub>
      = (F * 162) + (0 * 161) + (A * 160)
      = (15 * 162) + (0 * 161) + (10 * 160)
      = (15 * 256) + (0 * 16) + (10 * 1)
      = (3840) + (0) + (10)
      = 3850<sub>10</sub>
</pre>

So there you have it. Hexadecimal numbers made easy! You already know hexadecimal. Just change the base from 10 to 16. And have a cup of `0xC0FFEE` while you're at it!

Thanks for reading. 😃

*Follow me on Twitter [`@realEdwinTorres`](https://twitter.com/realEdwinTorres) for more programming tips and help.*
Hacktoberfest!
Tags: hacktoberfest, opensource
Published: 2020-10-23 21:05:14

## What I Learned From Hacktoberfest

<!-- What did you learn that can help others contribute to the project you worked on? What did you learn that can help the users of that project?! -->

I contributed to the UI for this budgeting application! https://github.com/gouri-panda/BudgetApp/pull/32

It's easy once you get the hang of finding and reading through the README files of each repository, deciding whether or not you can contribute to any issues on the repos, and just doing great work! Push it back up, and go find more to contribute to! Open source!
Testing login using Cypress.io
Tags: testing, webdev, cypress
Published: 2020-10-23 20:58:15

I wrote about using [Cypress.io](https://www.cypress.io/) to test our web application (https://www.dolthub.com). We recently started supporting tests for login and private paths. This blog compares two login options we considered for best testing the workflows on our website with some examples.

Read the blog here: https://www.dolthub.com/blog/2020-10-23-cypress-login-tests/
Check out our suite of Cypress tests here: https://github.com/dolthub/dolthub-cypress
My Python Courses
Tags: hacktoberfest, opensource
Published: 2020-10-23 20:50:02

---
title: My Python Courses
published: true
tags: hacktoberfest, opensource 
---
<!-- ✨This template is only meant to get your ideas going, so please feel free to write your own title, structure, and words! ✨ -->


### [Python Courses: learn the python programming language. Python is a programming language high level. It is one of the most interesting programming languages of the moment. Python is easy to learn, python is often used as an example when learning programming. You will find on this site tutorials, the computer tutorials that will teach you the basics for understanding Python language. For more experienced developers the site will show you some tips for your Python projects. You will discover that this my courses web site is the better space to improve your skills in Python, django, opencv, python online, python 3, scrapy, opencv python, python web, python mongodb,]
<!-- If you are new to the DEV community, introduce yourself and share a bit about why you joined DEV and decided to participate in Hacktoberfest this year.  --> 
### Background

<!-- Are you brand new to open source? What about coding in general? Tell us about how you got here →

### Progress

<!-- Share a bit about where you’re at in your Hacktoberfest journey. What stage are you at? How has the process been?  -->

### Contributions

<!-- This is where you can list the contributions you made and explain why you chose the projects you did. Don’t forget to add links!  -->


### Reflections
<!-- Overall, how has your Hacktoberfest 2020 experience been? If you’re a first-timer, will you participate again? What have you learned? Have you made any interesting connections? What is your next step in open source?  -->
FREE hosting for your open source project
Tags: opensource, hosting, cloud
Published: 2020-10-23 20:28:44

Fosshost a non-profit organisation provides free hosting to open source projects.

Our sponsors include DigitalOcean.com, FDCServers.net, Hostkey.com, Jolt.co.uk, Serverius.net and Rapidswitch.com.

We are helping more than 70 open source projects globally.

Projects can benefit from our free hosting services which can be used to help design, build, run, and deploy your code and deployments for the benefit and use of the wider open source community.

We are interested in hearing from talented groups and individuals who are seeking world-class hosting to power your project.

{% twitter 1319262059326889985 %}

Interested? Apply at https://fosshost.org
Wanna become a great Java developer . . ?
Tags: java, computerscience
Published: 2020-10-23 20:24:32

If you want to become a great Java developer, then you must have a good understanding of the Java virtual machine, the JVM where your Java codes run. Read this article which explains the JIT compiler of Java virtual machine.

https://medium.com/runtimeerror/java-jit-compiler-c538e5e06a2
Send Slack Notification if User Uploads a File to a Web Form
Tags: wayscript, tutorial, startup
Published: 2020-10-23 20:23:18

Introduction
------------

Today, we’ll use the WayScript platform to build a script to send Notification via Slack if Condition met in user-uploaded file.

Prerequisites
-------------

No prerequisites for this tutorial but here is the documentation worth reading.

*   [Working with Form Trigger](https://docs.wayscript.com/library/triggers/form-trigger)
*   [Working with Slack](https://docs.wayscript.com/library/logic/conditionals)
*   [Working with conditions](https://docs.wayscript.com/library/modules/slack)

Form Trigger
------------

For the Trigger, we’ll use Form Trigger. The objective is to receive files, then run the script and the conditions following the Trigger.  
Add it as a new Trigger.

![Adding Trigger](https://wayscript.com/blog_img/141/1.png)

Now we can configure the Trigger. First, let’s add useful information to the form.

![Adding Descriptions](https://wayscript.com/blog_img/141/2.png)

We can now create the form element. Choose File input as element type and .pdf for extensions.

![Adding Form elements](https://wayscript.com/blog_img/141/3.png)

Conditionals
------------

The next step is to put some conditions on the file before sending the Slack notification. For this tutorial, we’ll ensure that we are receiving a pdf file.  
Add If/Else as a new step.

![Adding conditionals modules](https://wayscript.com/blog_img/141/4.png)

Once it’s done, we’ll add an input: the comparison. We’ll compare the extension of the file to “pdf” string.

![condition](https://wayscript.com/blog_img/141/5.png)

Great. If you’ve noticed, adding an If/Else module creates two branches: one If the condition is valid (If branch) and one if the condition is invalid (Else). WayScript allows you to add many modules to the branches. It all depends on your needs. Well, in the If branch, add the Slack module.

![Adding Slack module](https://wayscript.com/blog_img/141/6.png)

If you’ve added the module, we can easily configure it now.

![Configuration of Slack module](https://wayscript.com/blog_img/141/7.png)

And now, let’s add a message.

![Slack Message](https://wayscript.com/blog_img/141/8.png)

Great! In the Else branch, I’ve added the Write to Log module, to print a message when the condition is not met.

![Log message](https://wayscript.com/blog_img/141/9.png)

if you’ve followed well this tutorial, here’s how your workflow should look like.

![Workflow image](https://wayscript.com/blog_img/141/10.png)

The Script is ready now. Be sure to have your Trigger turned on, so everyone can access the webpage.

Conclusion
----------

Questions about this script or anything else? Join our [Discord](https://discord.gg/VWbXSbj). We're always around to help. If you want to work with the full script template, just find it [here](https://wayscript.com/user/mangabo_kolawole/ie7G0FO_)
Running an Online Conference using Microsoft Azure
Tags: azure, tutorial, cloud
Published: 2020-10-23 20:12:43

#### 📺 042 - Andy Morell 🎙️ Frank Boucher

{% youtube gm9mzwrH0nA %}

In this episode Frank is with Andy Morell, an [Microsoft MVP](http://mvp.microsoft.com/) about how he led [The Live Coders](https://livecoders.dev/) production team in producing several online conferences in 2020 using an infrastructure running in Azure.

In the first part of this video we will learn more about Andy, what's his specialty as MVP, how he became a developer and more [complete interview here](https://youtu.be/YBwdtWLGHCQ). Andy will then explain how you can build a scalable and reliable solution using [Ant Media Server Community Edition](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/antmedia.ams_community_edition?WT.mc_id=allaroundazure-devto-frbouche) on Azure Virtual Machines. And explains where to find the required [NVIDIA GPU drivers](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/n-series-driver-setup?WT.mc_id=allaroundazure-devto-frbouche). You can see all the explanations and [demo here](https://youtu.be/xN8CG2pcRkw).

In the last part of this episode Andy and Frank will explore a Microsoft Learn module named: [Introduction to Azure virtual machines](https://docs.microsoft.com/en-us/learn/modules/intro-to-azure-virtual-machines/?WT.mc_id=allaroundazure-devto-frbouche), perfect to get started with VMs in Azure. The challenge was send how did that module? Tag us [@allaroundazure](https://twitter.com/allaroundazure) on Twitter and let us know. You can see the the [Learn Module segment here](https://youtu.be/w8XQKC2cwNo).


### Useful Links

🔗 [Ant Media Server Community Edition Azure VM](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/antmedia.ams_community_edition?WT.mc_id=allaroundazure-devto-frbouche)

🔗 [Install NVIDIA GPU drivers on N-series VMs running Windows](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/n-series-driver-setup?WT.mc_id=allaroundazure-devto-frbouche)

🔗 [Azure Advisor](https://azure.microsoft.com/en-ca/services/advisor?WT.mc_id=allaroundazure-devto-frbouche)

🔗 [10 Tips to Reduce your Azure Virtual Machines (VMs) Cost](https://c5m.ca/ep57)


### Learn Module:

💡 [Introduction to Azure virtual machines](https://docs.microsoft.com/en-us/learn/modules/intro-to-azure-virtual-machines/?WT.mc_id=allaroundazure-devto-frbouche) 


### All Video segment of the Episode 

📺 [Episode Summary](https://www.youtube.com/watch?v=gm9mzwrH0nA)

📺 [Andy Morell Interview](https://youtu.be/YBwdtWLGHCQ)

📺 [Episode Demo](https://youtu.be/xN8CG2pcRkw)

📺 [Learn Module Overview](https://youtu.be/w8XQKC2cwNo)

📺 [Full length unedited video](https://youtu.be/g7_UgLct56U)


### Learn more about Andy Morell

🔗 [@TheS7evin](https://twitter.com/TheS7evin)

🔗 [Bio](https://mvp.microsoft.com/en-us/PublicProfile/5003621?fullName=Andy%20Morrell)


---

### Find Us On

📺 Twitch [microsoftdeveloper](https://www.twitch.tv/microsoftdeveloper)

🔗 Twitter [@allaroundazure](https://twitter.com/allaroundazure)

☁️